]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
12 years agostruct timespec32: change types of tv_sec and tv_nsec fields to signed
Sergey Kandaurov [Fri, 11 Nov 2011 07:17:00 +0000 (07:17 +0000)]
struct timespec32: change types of tv_sec and tv_nsec fields to signed
to match native struct timespec ABI on __LP32__.

This change is a prerequisite for upcoming futimens()/utimensat() in whose
implementations it is assumed that timespec32 can take a negative value.

MFC after: 1 week

12 years agoStyle.
Konstantin Belousov [Fri, 11 Nov 2011 04:13:47 +0000 (04:13 +0000)]
Style.

MFC after: 1 week

12 years agoGuard against the unlikely case of the alias path containing the '%' symbols.
Konstantin Belousov [Fri, 11 Nov 2011 04:12:58 +0000 (04:12 +0000)]
Guard against the unlikely case of the alias path containing the '%' symbols.

Reported by: arundel
MFC after: 1 week

12 years agoWeaken the part of assertions added in the r227394. Only check that the
Konstantin Belousov [Fri, 11 Nov 2011 04:10:36 +0000 (04:10 +0000)]
Weaken the part of assertions added in the r227394. Only check that the
process state is stopped.

MFC after: 1 week

12 years agoCorrect the types of the arguments to return probes of the syscall
Ryan Stone [Fri, 11 Nov 2011 03:49:42 +0000 (03:49 +0000)]
Correct the types of the arguments to return probes of the syscall
provider.  Previously we were erroneously supplying the argument types of
the corresponding entry probe.

Reviewed by: rpaulo
MFC after: 1 week

12 years agoConverting int to wint_t leads to broekn comparison of raw char
Kevin Lo [Fri, 11 Nov 2011 01:35:07 +0000 (01:35 +0000)]
Converting int to wint_t leads to broekn comparison of raw char
and encoded wint_t.

Spotted by: ache

12 years agoCorrect device id comments.
Adrian Chadd [Fri, 11 Nov 2011 00:48:41 +0000 (00:48 +0000)]
Correct device id comments.

12 years agoRevert this previous commit for now - although this override unfortunately
Adrian Chadd [Thu, 10 Nov 2011 23:16:59 +0000 (23:16 +0000)]
Revert this previous commit for now - although this override unfortunately
results in the HAL being built without HAL debugging/diagnostic support,
the module building process needs to be somehow taught to not build AR5416+
NICs if AH_SUPPORT_AR5416 isn't defined in opt_ah.h .

12 years agoRemove dead ifdef. Driver should always check raised interrupt is
Pyun YongHyeon [Thu, 10 Nov 2011 23:14:04 +0000 (23:14 +0000)]
Remove dead ifdef.  Driver should always check raised interrupt is
for the device.

12 years agostyle.
Pyun YongHyeon [Thu, 10 Nov 2011 22:15:11 +0000 (22:15 +0000)]
style.
No functional changes.

12 years agoOn i386, fbt probes are implemented by writing an invalid opcode over
Ryan Stone [Thu, 10 Nov 2011 22:03:35 +0000 (22:03 +0000)]
On i386, fbt probes are implemented by writing an invalid opcode over
certain instructions in a function prologue or epilogue.  DTrace has a
hook into the invalid opcode fault handler that checks whether the fault
was due to an probe and if so, runs the DTrace magic.

Upon returning from an invalid opcode fault caused by a probe, DTrace must
emulate the instruction that was replaced with the invalid opcode and then
return control to the instruction following the invalid opcode.

There were a pair of related bugs in the emulation for the leave
instruction.  The leave instruction is used to pop off a stack frame prior
to returning from a function.  The emulation for this instruction must
move the trap frame for the invalid opcode fault down the stack to the
bottom of the stack frame that is being removed, and then execute an iret.

At two points in this process, the emulation code was storing values above
the current value of the stack pointer.  This opened up a window in which
if we were two take an interrupt, the trap frame for the interrupt would
overwrite the values stored on the stack, causing the system to panic
later.

The first bug was that at one point the emulation code saves the new value
for $esp above the current stack pointer value.  The fix is to save this
value instead inside of the original trap frame.  At this point we do
not need the original trap frame so this is safe.

The second bug is that when the emulate code loads $esp from the stack, it
points part-way through the new trap frame instead of at its beginning.
The emulation code adjusts the stack pointer to the correct value
immediately afterwards, but this still leaves a one instruction window in
which an interrupt would corrupt this trap frame.  Fix this by adjusting
the stack frame value before loading it into $esp.

This fixes panics in invop_leave on i386 when using fbt return probes.

Reviewed by: rpaulo, attilio
MFC after: 1 week

12 years agoThe generated Makefile for the kernel was not running ctfconvert on
Ryan Stone [Thu, 10 Nov 2011 21:07:14 +0000 (21:07 +0000)]
The generated Makefile for the kernel was not running ctfconvert on
object files corresponding to source files that had the compile-with
option set in conf/files.  This means that any fbt probes for functions
in that object file would not have correct argument types.

The fix is to run ctfconvert on any target file that does not have the
no-obj option set in files.

PR: bin/160275
Reported by: Paul Ambrose (ambrosehua AT gmail DOT com)
MFC after: 1 week

12 years agoRevert r227403 for now. Since the cross-tools stage purposefully
Dimitry Andric [Thu, 10 Nov 2011 20:15:35 +0000 (20:15 +0000)]
Revert r227403 for now.  Since the cross-tools stage purposefully
doesn't have ${WORLDTMP}/usr/bin in its PATH, if you build world with
CC=clang, tblgen tools from /usr/bin will be used instead of the ones
built under ${WORLDTMP}.  This can lead to various errors, especially if
you upgrade from an older clang.

Note that building world with gcc would not experience these problems,
because it only uses the tblgen tools in the world stage, where PATH
does contain ${WORLDTMP}/usr/bin.

Pointy hat to: dim

12 years agoAdd a missing reference to AR9287.
Adrian Chadd [Thu, 10 Nov 2011 17:01:34 +0000 (17:01 +0000)]
Add a missing reference to AR9287.

Sponsored by: Hobnob, Inc.

12 years agoNote that NAT instance argument can be tablearg.
Gleb Smirnoff [Thu, 10 Nov 2011 12:05:26 +0000 (12:05 +0000)]
Note that NAT instance argument can be tablearg.

PR: misc/162265
Submitted by: Paul Procacci <pprocacci gmail.com>

12 years agoSync definitions with <sys/mtio.h> header.
Sergey Kandaurov [Thu, 10 Nov 2011 11:17:40 +0000 (11:17 +0000)]
Sync definitions with <sys/mtio.h> header.

12 years agoFix date of commit bit proposing (s/2010/2011/)
Ruslan Makhmatkhanov [Thu, 10 Nov 2011 08:03:31 +0000 (08:03 +0000)]
Fix date of commit bit proposing (s/2010/2011/)

Spotted by:    pluknet
Approved by:   novel (mentor)

12 years agoDocument that flock can return ENOLCK
Doug Barton [Thu, 10 Nov 2011 06:20:18 +0000 (06:20 +0000)]
Document that flock can return ENOLCK

12 years agoAdd myself.
Ruslan Makhmatkhanov [Thu, 10 Nov 2011 06:19:18 +0000 (06:19 +0000)]
Add myself.

Approved by: novel (mentor)

12 years ago- Don't handle out-of-memory condition
Kevin Lo [Thu, 10 Nov 2011 01:44:05 +0000 (01:44 +0000)]
- Don't handle out-of-memory condition
- Fix types of function arguments match their declaration

Reviewed by: delphij
Obtained from: NetBSD

12 years agoSince these include wlan/ath/ah headers and these can change
Adrian Chadd [Wed, 9 Nov 2011 23:53:13 +0000 (23:53 +0000)]
Since these include wlan/ath/ah headers and these can change
definitions based on the state of the kernel compile environment,
ensure the opt_*.h files are available.

12 years agoUse the system-provided opt_ah.h if one is provided.
Adrian Chadd [Wed, 9 Nov 2011 23:37:13 +0000 (23:37 +0000)]
Use the system-provided opt_ah.h if one is provided.

This implies that users who are building the driver do so with
KERNBUILDDIR set to the compile/CONFIG directory so the various
opt_* sources can be pulled in.

12 years agoBump this up to where it used to be.
Adrian Chadd [Wed, 9 Nov 2011 23:28:47 +0000 (23:28 +0000)]
Bump this up to where it used to be.

I need to investigate this a little closer, but it seems that in noisy
environments the NF load takes longer than 5 * DELAY(10) and this is
messing up future NF calibrations. (The background: NF calibrations
begin at the value programmed in after the load has completed, so
if this is never loaded in, the NF calibrations only ever start at
the currently calibrated NF value, rather than starting at something
high (say -50.)

More investigation about the effect on 11n RX and calibration results
are needed.

Sponsored by: Hobnob, Inc.

12 years agoIntroduce a work-around for issues with the AR5416 based MAC on SMP devices.
Adrian Chadd [Wed, 9 Nov 2011 22:39:44 +0000 (22:39 +0000)]
Introduce a work-around for issues with the AR5416 based MAC on SMP devices.

The AR5416 MAC (which shows up in the AR5008, AR9001, AR9002 devices) has
issues with PCI transactions on SMP machines. This work-around enforces
that register access is serialised through a (global for now) spinlock.

This should stop the hangs people have seen with the AR5416 PCI devices
on SMP hosts.

Obtained by: Linux, Atheros

12 years agoDo a dummy read to flush the interrupt ACK that we just performed,
Xin LI [Wed, 9 Nov 2011 21:53:49 +0000 (21:53 +0000)]
Do a dummy read to flush the interrupt ACK that we just performed,
ensuring that everything is really, truly consistent.

This fixes certain cases where one will see various:

mfi0: COMMAND 0xffffffXXXXXXXXXX TIMEOUT AFTER XX SECONDS

MFC after: 3 days
Submitted by: scottl
Ok'ed by: jhb

12 years agoCommit a missing fix - the AR_SREV_KIWI_10_OR_LATER() check.
Adrian Chadd [Wed, 9 Nov 2011 21:41:18 +0000 (21:41 +0000)]
Commit a missing fix - the AR_SREV_KIWI_10_OR_LATER() check.

12 years agoRemove trailing whitespace.
Ed Schouten [Wed, 9 Nov 2011 21:01:50 +0000 (21:01 +0000)]
Remove trailing whitespace.

12 years agoEven though the HAL doesn't currently support Kiwi 1.0/1.1,
Adrian Chadd [Wed, 9 Nov 2011 19:09:03 +0000 (19:09 +0000)]
Even though the HAL doesn't currently support Kiwi 1.0/1.1,
be "more correct" about the Kiwi setup.

Obtained from: Atheros

12 years agoAdd definition of some USB 3.0 descriptors to libusb 1.0 and libusb 2.0.
Hans Petter Selasky [Wed, 9 Nov 2011 19:03:26 +0000 (19:03 +0000)]
Add definition of some USB 3.0 descriptors to libusb 1.0 and libusb 2.0.
Some header file parts of this patch were taken from a patch submitted
by Maya Erez <merez@codeaurora.org> to the LibUSB developers list.

MFC after: 1 week

12 years agoMove building of clang's tblgen tools (and required libraries) from the
Dimitry Andric [Wed, 9 Nov 2011 19:00:27 +0000 (19:00 +0000)]
Move building of clang's tblgen tools (and required libraries) from the
bootstrap-tools stage to the cross-tools stage.  These tools are only
needed for generating llvm/clang include files, and are not necessary
for bootstrapping the build itself.

This shaves off some build time, because the required libraries are now
just built twice (during the cross-tools and world stages), instead of
three times.

Also, if you build world using WITHOUT_CLANG= in src.conf(5), no llvm or
clang code will be compiled at all anymore.

MFC after: 1 week

12 years agoFix size of USB 3.0 descriptor field.
Hans Petter Selasky [Wed, 9 Nov 2011 18:48:36 +0000 (18:48 +0000)]
Fix size of USB 3.0 descriptor field.

MFC after: 3 days

12 years agoAttempt to improve formatting and content of several comments for
Konstantin Belousov [Wed, 9 Nov 2011 18:25:50 +0000 (18:25 +0000)]
Attempt to improve formatting and content of several comments for
amd64 and i386 MD code.

Based on suggestions by: bde
MFC after: 1 week

12 years agoIf software retransmit occurs with an ath_buf marked ATH_BUF_BUSY,
Adrian Chadd [Wed, 9 Nov 2011 18:24:20 +0000 (18:24 +0000)]
If software retransmit occurs with an ath_buf marked ATH_BUF_BUSY,
it's cloned and that clone is retransmitted. This means that the
ath_buf pointer squirreled away on the baw window array is suddenly
wrong and was causing all kinds of console output.

This updates the pointer in that particular BAW slot to the new
ath_buf after ensuring that:

* the new and old buffers have the same seqno;
* the current slot pointer matches the old buffer pointer.

This quietens the debugging output (again), restoring said debugging
to only signify when a broken condition has occured.

Sponsored by: Hobnob, Inc.

12 years agoFix size of USB 3.0 descriptor field.
Hans Petter Selasky [Wed, 9 Nov 2011 18:11:29 +0000 (18:11 +0000)]
Fix size of USB 3.0 descriptor field.

MFC after: 3 days

12 years agoFlip on processing interrupt profile events for mips24k.
Adrian Chadd [Wed, 9 Nov 2011 17:38:27 +0000 (17:38 +0000)]
Flip on processing interrupt profile events for mips24k.

This is a bit hackish and should be made more generic (ie, support more than
two hard-coded performance counter+config register pairs) so it can be used
for mips74k and other chips.

All this does is process the initial interrupt event. It doesn't (yet) handle
callgraph events, so even if you route the exception/interrupt to this routine
and flip the bit on, it will hang and crash pmc unless you disable callgraph
support when you enable a sample based PMC.

12 years agoStopped process may legitimately have some threads sleeping and not
Konstantin Belousov [Wed, 9 Nov 2011 17:25:43 +0000 (17:25 +0000)]
Stopped process may legitimately have some threads sleeping and not
suspended, if the sleep is uninterruptible.

Reported and tested by: pho
MFC after: 1 week

12 years agoLock the thread lock around block that retrieves td_wmesg. Otherwise,
Konstantin Belousov [Wed, 9 Nov 2011 17:15:51 +0000 (17:15 +0000)]
Lock the thread lock around block that retrieves td_wmesg. Otherwise,
procfs could see a thread with assigned td_wchan but still NULL td_wmesg.

Reported and tested by: pho
MFC after: 1 week

12 years agoAssert that _PRELE() is done for the held process.
Konstantin Belousov [Wed, 9 Nov 2011 17:13:41 +0000 (17:13 +0000)]
Assert that _PRELE() is done for the held process.

Tested by: pho
MFC after: 1 week

12 years agoImport gcc fix for -fstack-protector that produces segfaulting
Fabien Thomas [Wed, 9 Nov 2011 15:59:02 +0000 (15:59 +0000)]
Import gcc fix for -fstack-protector that produces segfaulting
binaries on arm/armel.

Related gcc bug:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35965

PR: 161128
MFC after: 1 week

12 years agoAdd myself.
Josh Paetzel [Wed, 9 Nov 2011 15:21:48 +0000 (15:21 +0000)]
Add myself.

Approved by: kib (mentor)

12 years agoRevert some debugging printfs that crept into 223695.
John Baldwin [Wed, 9 Nov 2011 14:37:47 +0000 (14:37 +0000)]
Revert some debugging printfs that crept into 223695.

12 years ago* Force the MAC to wakeup before we try resetting it, to ensure
Adrian Chadd [Wed, 9 Nov 2011 14:34:25 +0000 (14:34 +0000)]
* Force the MAC to wakeup before we try resetting it, to ensure
  it actually _gets_ reset properly.
* Add some more comments describing why things are done.

Obtained from: Atheros

12 years agoTidy up the AR9287 HAL a tiny bit - fix up AR9280 references.
Adrian Chadd [Wed, 9 Nov 2011 14:30:58 +0000 (14:30 +0000)]
Tidy up the AR9287 HAL a tiny bit - fix up AR9280 references.

12 years agoFix a bug where the pmap_cpu_bootstrap() ap argument could be clobbered.
Nathan Whitehorn [Wed, 9 Nov 2011 13:48:23 +0000 (13:48 +0000)]
Fix a bug where the pmap_cpu_bootstrap() ap argument could be clobbered.
Luckily, it mostly wasn't important, so this didn't cause major problems.
Also improve register reuse when setting up trap frames very slightly.

Submitted by: Justin Hibbits <chmeeedalf at gmail dot com>
MFC after: 5 days

12 years agoRestore the comment that I removed by accident.
Ed Schouten [Wed, 9 Nov 2011 13:26:59 +0000 (13:26 +0000)]
Restore the comment that I removed by accident.

The comment still applies to this block of code.

12 years agoSimplify the code emitted by makeobjops.awk slightly.
Ed Schouten [Wed, 9 Nov 2011 11:00:29 +0000 (11:00 +0000)]
Simplify the code emitted by makeobjops.awk slightly.

Just place the default kobj_method inside the kobjop_desc structure.
There's no need to give these kobj_methods their own symbol. This shaves
off 10 KB of a GENERIC kernel binary.

12 years agoSome minor corrections to a modem driver.
Hans Petter Selasky [Wed, 9 Nov 2011 09:15:57 +0000 (09:15 +0000)]
Some minor corrections to a modem driver.

PR: usb/162307
MFC after: 3 days

12 years agoUse implementation independent inoNN_t scalars for on-disk UFS structures
Gleb Kurtsou [Wed, 9 Nov 2011 07:48:48 +0000 (07:48 +0000)]
Use implementation independent inoNN_t scalars for on-disk UFS structures

Approved by: mdf (mentor)

12 years agoMigrate the AR5416 ANI code to use the previously introduced method
Adrian Chadd [Wed, 9 Nov 2011 05:48:20 +0000 (05:48 +0000)]
Migrate the AR5416 ANI code to use the previously introduced method
to fetch the current channel busy statistics, rather than duplicating
it here.

This forms the (very crude) basis for doing basic channel surveying.

Sponsored by: Hobnob, Inc.

12 years agoDisable OFDM weak signal detection by default. Leave this to be
Adrian Chadd [Wed, 9 Nov 2011 05:45:30 +0000 (05:45 +0000)]
Disable OFDM weak signal detection by default. Leave this to be
enabled if required by STA operation.

This quietens a lot of OFDM errors seen in hostap mode, where
there are no beacon RSSI levels to tune the dynamic range of the
baseband.

This may reduce reception range at the fringes, but does increase
stability.

Sponsored by: Hobnob, Inc.

12 years agoUse a restricted set of parameters when operating in hostap mode.
Adrian Chadd [Wed, 9 Nov 2011 05:43:48 +0000 (05:43 +0000)]
Use a restricted set of parameters when operating in hostap mode.

The 5ghz hostap mode (where DFS is being done) requires ANI to be disabled
or the radar detection parameters don't work as advertised (as they're based
on signal strength level, and tweaking ANI affects the signal strangth,
dynamic range and power increase the baseband is looking for in order to
detect it as a "signal".)

Obtained from: Linux, Atheros
Sponsored by: Hobnob, Inc.

12 years agoAdd logic to ANI to tweak the firstep parameter when in hostap mode.
Adrian Chadd [Wed, 9 Nov 2011 05:41:40 +0000 (05:41 +0000)]
Add logic to ANI to tweak the firstep parameter when in hostap mode.
This is normally done based on the beacon RSSI but this isn't available
in hostap mode.

Obtained from: Atheros
Sponsored by: Hobnob, Inc.

12 years ago.. and add some ANI fixes missing from the last ANI commit.
Adrian Chadd [Wed, 9 Nov 2011 05:39:17 +0000 (05:39 +0000)]
.. and add some ANI fixes missing from the last ANI commit.

Obtained from: Atheros
Sponsored by: Hobnob, Inc.

12 years agoInclude some ANI fixes for the AR5416.
Adrian Chadd [Wed, 9 Nov 2011 05:37:11 +0000 (05:37 +0000)]
Include some ANI fixes for the AR5416.

* If we fall through from an ANI command (eg because it's out of range,
  or it's disabled) then fall through to the next ANI command rather then
  being stuck there.

* Fix some off-by-one comparisons, meaning the final level in some parameters
  were never tweaked.

Obtained from: Atheros
Sponsored by: Hobnob, Inc.

12 years agoAdd a new HAL parameter which forces a full reset rather than warm reset.
Adrian Chadd [Wed, 9 Nov 2011 05:30:24 +0000 (05:30 +0000)]
Add a new HAL parameter which forces a full reset rather than warm reset.
This forces a full reset of the baseband/radio and seems needed to clear
some issues (with Merlin at least) when the baseband gets confused in a
very noisy environment.

Sponsored by: Hobnob, Inc.

12 years agoPort over a new routine which grabs the percentage of time spent in TX frame, RX...
Adrian Chadd [Wed, 9 Nov 2011 05:25:30 +0000 (05:25 +0000)]
Port over a new routine which grabs the percentage of time spent in TX frame, RX frame,
RX clear, RX extension clear.

This is useful for estimating channel business.

The same routines should be written for AR5210->AR5212 where appopriate.

Obtained from: Atheros

12 years agoAdd in some more PCI/PCIe differentiation.
Adrian Chadd [Wed, 9 Nov 2011 04:38:27 +0000 (04:38 +0000)]
Add in some more PCI/PCIe differentiation.

12 years agoTry to make it more obvious when users are using the PCI or PCIe versions of
Adrian Chadd [Wed, 9 Nov 2011 04:35:33 +0000 (04:35 +0000)]
Try to make it more obvious when users are using the PCI or PCIe versions of
the 11n chips.

12 years agoFix the compile to work when IEEE80211_DEBUG isn't defined.
Adrian Chadd [Wed, 9 Nov 2011 04:08:01 +0000 (04:08 +0000)]
Fix the compile to work when IEEE80211_DEBUG isn't defined.

Sponsored by: Hobnob, Inc.

12 years agoTidy up command line processing:
Greg Lehey [Wed, 9 Nov 2011 01:40:46 +0000 (01:40 +0000)]
Tidy up command line processing:
  - Add ? option to optstring.
  - Sort options alphabetically.
  - Vertical space.

Tidy up usage() function.

Bring man page in sync with source.

Ensure that debug code is only executed with the -d option.

Submitted by: Christiane Yeardley

12 years agosh: Remove undefined behaviour due to overflow in +/-/* in arithmetic.
Jilles Tjoelker [Tue, 8 Nov 2011 23:54:39 +0000 (23:54 +0000)]
sh: Remove undefined behaviour due to overflow in +/-/* in arithmetic.

With i386 base gcc and i386 base clang, arith_yacc.o remains unchanged.

12 years agoWelcome the initial patches for OSX bootcamp support!!!
Josh Paetzel [Tue, 8 Nov 2011 23:44:26 +0000 (23:44 +0000)]
Welcome the initial patches for OSX bootcamp support!!!
This should let you select the ada0p3 hybrid MBR/GPT partition, and do an installation to it.

Approved by: kib (mentor)
Obtained from: kris@pcbsd.org
MFC after: 3 days

12 years agoComment out TI_JUMBO_HDRSPLIT. TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO.
Pyun YongHyeon [Tue, 8 Nov 2011 23:19:22 +0000 (23:19 +0000)]
Comment out TI_JUMBO_HDRSPLIT. TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO.

12 years agorc.d: Eliminate some unnecessary non-POSIX constructs:
Jilles Tjoelker [Tue, 8 Nov 2011 23:02:32 +0000 (23:02 +0000)]
rc.d: Eliminate some unnecessary non-POSIX constructs:

 * set - ...
 * empty braces
 * ^ in character class

12 years agoFix the KTR option to compile by default - it was referencing
Adrian Chadd [Tue, 8 Nov 2011 22:50:28 +0000 (22:50 +0000)]
Fix the KTR option to compile by default - it was referencing
some unmerged interrupt status debugging code from my branch.

* Add ah_intrstate[8] which will have the record of the last
  call to ath_hal_getintr().
* Wrap the KTR code behind ATH_KTR_INTR_DEBUG.
* Add the HAL interrupt debugging behind AH_INTERRUPT_DEBUGGING.

This is only done for the AR5416 and later NICs but it will be
trivial to add to the earlier NICs if required.

Neither are enabled by default, although to minimise HAL binary
API differences, the ah_intrstate[] array is always compiled into
the ath_hal struct.

12 years agoIntroduce TX aggregation and software TX queue management
Adrian Chadd [Tue, 8 Nov 2011 22:43:13 +0000 (22:43 +0000)]
Introduce TX aggregation and software TX queue management
for Atheros AR5416 and later wireless devices.

This is a very large commit - the complete history can be
found in the user/adrian/if_ath_tx branch.

Legacy (ie, pre-AR5416) devices also use the per-software
TXQ support and (in theory) can support non-aggregation
ADDBA sessions. However, the net80211 stack doesn't currently
support this.

In summary:

TX path:

* queued frames normally go onto a per-TID, per-node queue
* some special frames (eg ADDBA control frames) are thrown
  directly onto the relevant hardware queue so they can
  go out before any software queued frames are queued.
* Add methods to create, suspend, resume and tear down an
  aggregation session.
* Add in software retransmission of both normal and aggregate
  frames.
* Add in completion handling of aggregate frames, including
  parsing the block ack bitmap provided by the hardware.
* Write an aggregation function which can assemble frames into
  an aggregate based on the selected rate control and channel
  configuration.
* The per-TID queues are locked based on their target hardware
  TX queue. This matches what ath9k/atheros does, and thus
  simplified porting over some of the aggregation logic.
* When doing TX aggregation, stick the sequence number allocation
  in the TX path rather than net80211 TX path, and protect it
  by the TXQ lock.

Rate control:

* Delay rate control selection until the frame is about to
  be queued to the hardware, so retried frames can have their
  rate control choices changed. Frames with a static rate
  control selection have that applied before each TX, just
  to simplify the TX path (ie, not have "static" and "dynamic"
  rate control special cased.)
* Teach ath_rate_sample about aggregates - both completion and
  errors.
* Add an EWMA for tracking what the current "good" MCS rate is
  based on failure rates.

Misc:

* Introduce a bunch of dirty hacks and workarounds so TID mapping
  and net80211 frame inspection can be kept out of the net80211
  layer. Because of the way this code works (and it's from Atheros
  and Linux ath9k), there is a consistent, 1:1 mapping between
  TID and AC. So we need to ensure that frames going to a specific
  TID will _always_ end up on the right AC, and vice versa, or the
  completion/locking will simply get very confused. I plan on
  addressing this mess in the future.

Known issues:

* There is no BAR frame transmission just yet. A whole lot of
  tidying up needs to occur before BAR frame TX can occur in the
  "correct" place - ie, once the TID TX queue has been drained.

* Interface reset/purge/etc results in frames in the TX and RX
  queues being removed. This creates holes in the sequence numbers
  being assigned and the TX/RX AMPDU code (on either side) just
  hangs.

* There's no filtered frame support at the present moment, so
  stations going into power saving mode will simply have a number
  of frames dropped - likely resulting in a traffic "hang".

* Raw frame TX is going to just not function with 11n aggregation.
  Likely this needs to be modified to always override the sequence
  number if the frame is going into an aggregation session.
  However, general raw frame injection currently doesn't work in
  general in net80211, so let's just ignore this for now until
  this is sorted out.

* HT protection is just not implemented and won't be until the above
  is sorted out. In addition, the AR5416 has issues RTS protecting
  large aggregates (anything >8k), so the work around needs to be
  ported and tested. Thus, this will be put on hold until the above
  work is complete.

* The rate control module 'sample' is the only currently supported
  module; onoe/amrr haven't been tested and have likely bit rotted
  a little. I'll follow up with some commits to make them work again
  for non-11n rates, but they won't be updated to handle 11n and
  aggregation. If someone wishes to do so then they're welcome to
  send along patches.

* .. and "sample" doesn't really do a good job of 11n TX. Specifically,
  the metrics used (packet TX time and failure/success rates) isn't as
  useful for 11n. It's likely that it should be extended to take into
  account the aggregate throughput possible and then choose a rate
  which maximises that. Ie, it may be acceptable for a higher MCS rate
  with a higher failure to be used if it gives a more acceptable
  throughput/latency then a lower MCS rate @ a lower error rate.
  Again, patches will be gratefully accepted.

Because of this, ATH_ENABLE_11N is still not enabled by default.

Sponsored by: Hobnob, Inc.
Obtained from: Linux, Atheros

12 years agoAdd support to the TX descriptor printing code to follow ath_buf
Adrian Chadd [Tue, 8 Nov 2011 22:01:03 +0000 (22:01 +0000)]
Add support to the TX descriptor printing code to follow ath_buf
chains. This allows for debugging of aggregate frames.

Sponsored by: Hobnob, Inc.

12 years agoMake sure TXEOL is set on default queues. Otherwise we don't get an
Adrian Chadd [Tue, 8 Nov 2011 21:55:40 +0000 (21:55 +0000)]
Make sure TXEOL is set on default queues. Otherwise we don't get an
interrupt on the completion of a TX queue and this can cause TX
hangs / timeout.

Sponsored by: Hobnob, Inc.

12 years agoRefactor out the TX buffer management and completion code in
Adrian Chadd [Tue, 8 Nov 2011 21:49:33 +0000 (21:49 +0000)]
Refactor out the TX buffer management and completion code in
preparation for TX aggregation.

* Add in logic which calls ath_buf bf->bf_comp if it's set.
  This allows for AMPDU (and RIFS, and FF, if someone desires) code
  to handle completion - which includes freeing subframes, retransmitting
  subframes, etc.

* Break out the buffer free, buffer busy/unbusy default completion handler
  code into separate functions. This allows bf_comp methods to free and
  unbusy each subframe ath_buf as required.

* Break out the statistics update code into a separate function, just
  to clean up the TX completion path a little.

Sponsored by: Hobnob, Inc.

12 years agoChange the descriptor logic to use bf_lastds to point to the last
Adrian Chadd [Tue, 8 Nov 2011 21:25:36 +0000 (21:25 +0000)]
Change the descriptor logic to use bf_lastds to point to the last
descriptor, rather than using the maths involving bf_desc[bf_nseg - 1].

When doing TX aggregation, the status will be updated in the -final-
descriptor of the -final- subframe in an aggregate. Thus bf_lastds
may point to the last descriptor in a completely different ath_buf.

Sponsored by: Hobnob, Inc.

12 years agoChange ath_buf allocation to:
Adrian Chadd [Tue, 8 Nov 2011 21:13:05 +0000 (21:13 +0000)]
Change ath_buf allocation to:

* Immediately return NULL if a buffer isn't available;
* Track the "buffers not available" count;
* Clear some fields used for tx aggregation;
* Add ath_buf_clone() which clones the majority of buffer state.
  This is needed when retransmission of a "busy" buffer is required.

Sponsored by: Hobnob, Inc.

12 years agoBreak out the TX DMA stop code into a separate function.
Adrian Chadd [Tue, 8 Nov 2011 21:06:36 +0000 (21:06 +0000)]
Break out the TX DMA stop code into a separate function.

Sponsored by: Hobnob, Inc.

12 years agoAdd a 'vap' to ath_keyset().
Adrian Chadd [Tue, 8 Nov 2011 19:25:52 +0000 (19:25 +0000)]
Add a 'vap' to ath_keyset().

Add some code (which is currently disabled) which modifies the group
multicast key cache behaviour. I haven't yet figured out what the
exact/correct behaviour is so I'm leaving it disabled. It's worth
investigating and "correcting", especially for future work with
mesh/ibss and encryption.

Sponsored by: Hobnob, Inc.

12 years agoSome more various fixes, etc from my 11n branch.
Adrian Chadd [Tue, 8 Nov 2011 19:18:34 +0000 (19:18 +0000)]
Some more various fixes, etc from my 11n branch.

* When doing software TX queue handling and flush, it's possible
  that the deletion of a VAP (eg a STA shutdown) will queue a
  "STA Disassociate" frame whilst the interface is being deleted.
  The VAP is then deleted, and the frame ends up being queued
  to a node that is freed before it can be TX'ed. Things go awry
  at this point.

  There's no way at the present to avoid freeing the underlying node
  when the vap is being deleted. It's too late in the game.

  I suspect the real fix is to make sure the frame is software
  queued with no completion information somehow, so it doesn't
  link back to a node whose underlying VAP has been freed.
  For now, we'll just have to do this.

* Add some comments showing what's going on.

* Move an instance of the ATH_LOCK() around to protect the interrupt
  set. I'll worry about changing that to a PCU lock later on once
  the 11n code is in the tree.

Sponsored by: Hobnob, Inc.

12 years agoBumb date after r227317.
Mikolaj Golub [Tue, 8 Nov 2011 19:14:15 +0000 (19:14 +0000)]
Bumb date after r227317.

Reminded by: pluknet

12 years agoAdd KTR tracepoints to the ath driver, in order to debug TX, RX
Adrian Chadd [Tue, 8 Nov 2011 19:02:59 +0000 (19:02 +0000)]
Add KTR tracepoints to the ath driver, in order to debug TX, RX
and interrupt handling.

Sponsored by: Hobnob, Inc.

12 years agoIn preparation for supporting 11n TX/RX properly, allow for TX queue draining
Adrian Chadd [Tue, 8 Nov 2011 18:56:52 +0000 (18:56 +0000)]
In preparation for supporting 11n TX/RX properly, allow for TX queue draining
and interface resets to be marked as ATH_RESET_DEFAULT, ATH_RESET_FULL,
ATH_RESET_NOLOSS.

Currently a reset is still a reset - ie, all tx/rx frames in the hardware
queues are purged. This means that those frames will be lost to the 11n TX
and RX aggregation state tracking, breaking AMPDU sessions.

The (eventual) new semantics:

* ATH_RESET_DEFAULT:
      full reset, this is the default for reset situations
      which I haven't yet figured out what they should be.
* ATH_RESET_FULL:
      A full reset - for things such as channel changes.
* ATH_RESET_NOLOSS:
      Don't flush TX/RX queues - handle pending RX frames and leave TX
      frames where they are; restart TX DMA from where it was.

12 years agoBreak out the node cleanup and node free path, in preparation for
Adrian Chadd [Tue, 8 Nov 2011 18:48:26 +0000 (18:48 +0000)]
Break out the node cleanup and node free path, in preparation for
doing software TX queue management.

The software queued TX frames will be freed by the new cleanup
function.

Sponsored by: Hobnob, Inc.

12 years agoPreparation for correct 802.11n tx/rx handling.
Adrian Chadd [Tue, 8 Nov 2011 18:45:15 +0000 (18:45 +0000)]
Preparation for correct 802.11n tx/rx handling.

* Change ath_rx_proc() to ath_rx_tasklet(); make that the taskqueue function.
  This way (eventually) ath_rx_proc() can be called from elsewhere in the
  packet reset/processing queue so frames aren't just "flushed" during
  interface resets/reconfigure. This breaks 802.11n RX aggregation tracking.
* Extend ath_tx_proc() to take a 'resched' flag, which marks whether to
  reschedule further RX PCU reads or not.
* Change ath_tx_processq() to take a "dosched" flag, which will eventually
  be used to indicate whether to reschedule the software TX scheduler.

Sponsored by: Hobnob, Inc.

12 years agoConditionally compile the PCI latency workaround; I think it's
Adrian Chadd [Tue, 8 Nov 2011 18:37:52 +0000 (18:37 +0000)]
Conditionally compile the PCI latency workaround; I think it's
only required for some earlier NICs.

12 years agoDocument TI_SF_BUF_JUMBO and Xr altq.
Pyun YongHyeon [Tue, 8 Nov 2011 18:36:59 +0000 (18:36 +0000)]
Document TI_SF_BUF_JUMBO and Xr altq.

12 years agoti(4) supports altq(4).
Pyun YongHyeon [Tue, 8 Nov 2011 18:35:11 +0000 (18:35 +0000)]
ti(4) supports altq(4).

12 years agoRetire 'options TI_PRIVATE_JUMBOS' and replace local jumbo
Pyun YongHyeon [Tue, 8 Nov 2011 18:23:02 +0000 (18:23 +0000)]
Retire 'options TI_PRIVATE_JUMBOS' and replace local jumbo
allocator with UMA backed jumbo allocator by default. Previously
ti(4) used sf_buf(9) interface for jumbo buffers but it was broken
at this moment such that enabling jumbo frame caused instant panic.
Due to the nature of sf_buf(9) it heavily relies on VM changes but
it seems ti(4) was not received much blessing from VM gurus.  I
don't understand VM magic and implications used in driver either.
Switching to UMA backed jumbo allocator like other network drivers
will make jumbo frame work on ti(4).
While I'm here, fully allocate all RX buffers. This means ti(4) now
uses 512 RX buffer and 1024 mini RX buffers.

To use sf_buf(9) interface for jumbo buffers, introduce a new
'options TI_SF_BUF_JUMBO'. If it is proven that sf_buf(9) is better
for jumbo buffers, interesting developers can fix the issue in
future.

ti(4) still needs more bus_dma(9) cleanups and should use separate
DMA tag/map for each ring(standard, jumbo, mini, command, event
etc) but it should work on all platforms except PAE.

Special thanks to Jay[1] who provided complete remote debugging
access.

Tested by: Jay Borkenhagen <jayb <> braeburn dot org > [1]

12 years agoMerge in some fixes from the if_ath_tx branch.
Adrian Chadd [Tue, 8 Nov 2011 18:10:04 +0000 (18:10 +0000)]
Merge in some fixes from the if_ath_tx branch.

* Close down some of the kickpcu races, where the interrupt handler
  can and will run concurrently with the taskqueue.
* Close down the TXQ active/completed race between the interrupt
  handler and the concurrently running tx completion taskqueue
  function.
* Add some tx and rx interrupt count tracking, for debugging.
* Fix the kickpcu logic in ath_rx_proc() to not simply drain and
  restart the TX queue - instead, assume the hardware isn't
  (too) confused and just restart RX DMA. This may break on
  previous chipsets, so if it does I'll add a HAL flag and
  conditionally handle this (ie, for broken chipsets, I'll
  just restore the "stop PCU / flush things / restart PCU"
  logic.)
* Misc stuff

Sponsored by: Hobnob, Inc.

12 years agoAdd IPv6 support to netblast/netsend/netreceive
Olivier Houchard [Tue, 8 Nov 2011 17:23:43 +0000 (17:23 +0000)]
Add IPv6 support to netblast/netsend/netreceive

PR: bin/161368
Submitted by: Olivier Cochard-Labbe <olivier AT cochard doT me>

12 years agoMigrate the STAILQ lists to TAILQs.
Adrian Chadd [Tue, 8 Nov 2011 17:08:12 +0000 (17:08 +0000)]
Migrate the STAILQ lists to TAILQs.

A bunch of the 11n TX aggregation logic wants to traverse lists of buffers
in various ways. In order to provide O(1) behaviour in this instance,
use TAILQs.

This does blow out the memory footprint and CPU cycles slightly for some
of these operations. I may convert some of these back to STAILQs once
the rest of the software transmit queue handling has been stabilised.

Sponsored by: Hobnob, Inc.

12 years agoMake kobj_methods constant.
Ed Schouten [Tue, 8 Nov 2011 15:38:21 +0000 (15:38 +0000)]
Make kobj_methods constant.

These structures hold no information that is modified during runtime. By
marking this constant, we see approximately 600 symbols become
read-only (amd64 GENERIC). While there, also mark the kobj_method
structures generated by makeobjops.awk static. They are only referenced
by the kobjop_desc structures within the same file.

Before:

$ ls -l kernel
-rwxr-xr-x  1 ed  wheel  15937309 Nov  8 16:29 kernel*
$ size kernel
    text    data     bss      dec    hex filename
12260854 1358468 2848832 16468154 fb48ba kernel
$ nm kernel | fgrep -c ' r '
8240

After:

$ ls -l kernel
-rwxr-xr-x  1 ed  wheel  15922469 Nov  8 16:25 kernel*
$ size kernel
    text    data     bss      dec    hex filename
12302869 1302660 2848704 16454233 fb1259 kernel
$ nm kernel | fgrep -c ' r '
8838

12 years agoThe in-kernel CTF parser caches the result of its first attempt to parse
Ryan Stone [Tue, 8 Nov 2011 15:17:54 +0000 (15:17 +0000)]
The in-kernel CTF parser caches the result of its first attempt to parse
CTF data from a module.  On subsequent attempts to retrieve CTF data for
a module, return an error if there no CTF data.

This fixes a panic if you try to enable fbt probes on a module with CTF
data twice.

Submitted by: Paul Ambrose (ambrosehua AT gmail DOT com)
MFC after: 3 days

12 years agoClaim that _POSIX_ADVISORY_INFO is fully supported since posix_fadvise()
John Baldwin [Tue, 8 Nov 2011 14:47:28 +0000 (14:47 +0000)]
Claim that _POSIX_ADVISORY_INFO is fully supported since posix_fadvise()
was added.

Submitted by: avilla
Discussed with: wollman

12 years agoSome cosmetic fixes to ath_rate_sample.
Adrian Chadd [Tue, 8 Nov 2011 14:46:03 +0000 (14:46 +0000)]
Some cosmetic fixes to ath_rate_sample.

* Use 64 bit integer types for the sample rate statistics.
  When TX'ing 11n aggregates, a 32 bit counter will overflow in a few
  hours due to the high packet throughput.

* Create a default label of "" rather than defaulting to "Mb" - that way
  if a rate hasn't yet been selected, it won't say "-1 Mb".

Sponsored by: Hobnob, Inc.

12 years ago.. add missing include from an incorrect merge.
Adrian Chadd [Tue, 8 Nov 2011 14:34:01 +0000 (14:34 +0000)]
.. add missing include from an incorrect merge.

Sponsored by: Hobnob, Inc.

12 years agoReject frames in STA mode which are not destined to the local STA address.
Adrian Chadd [Tue, 8 Nov 2011 14:28:33 +0000 (14:28 +0000)]
Reject frames in STA mode which are not destined to the local STA address.

Some hardware (eg the AR9160 in STA mode) seems to "leak" unicast FROMDS
frames which aren't destined to itself. This angers the net80211 stack -
the existing code would fail to find an address in the node table and try
passing the frame up to each vap BSS. It would then be accepted in the
input routine and its contents would update the local crypto and sequence
number state.

If the sequence number / crypto IV replay counters from the leaked frame
were greater than the "real" state, subsequent "real" frames would be
rejected due to out of sequence / IV replay conditions.

This is also likely helpful if/when multi-STA modes are added to net80211.

Sponsored by: Hobnob, Inc.

12 years agoAdd quiet time element configuration support to ifconfig.
Adrian Chadd [Tue, 8 Nov 2011 14:22:40 +0000 (14:22 +0000)]
Add quiet time element configuration support to ifconfig.

This allows a hostap to specify to a set of stations that they
should not transmit for a certain period of time after each
beacon interval has expired. This is used when searching for
radar pulses or general interference.

Submitted by: Himali Patel <himali.patel@sibridgetech.com>
Sponsored by: Sibridge Technologies

12 years agoSimplify getopt switch parsing.
Ed Schouten [Tue, 8 Nov 2011 11:36:46 +0000 (11:36 +0000)]
Simplify getopt switch parsing.

Only one of these flags can be set. Just add them together and check the
value. Also, get rid of the listall variable. The code is already filled
with direct *flag-comparisons.

Obtained from: Alexander Best (though modified)

12 years agoIntroduce the option VFS_ALLOW_NONMPSAFE and turn it on by default on
Attilio Rao [Tue, 8 Nov 2011 10:18:07 +0000 (10:18 +0000)]
Introduce the option VFS_ALLOW_NONMPSAFE and turn it on by default on
all the architectures.
The option allows to mount non-MPSAFE filesystem. Without it, the
kernel will refuse to mount a non-MPSAFE filesytem.

This patch is part of the effort of killing non-MPSAFE filesystems
from the tree.

No MFC is expected for this patch.

Tested by: gianni
Reviewed by: kib

12 years agoEnable PCI MMC/SD support by default on i386 and amd64
Kevin Lo [Tue, 8 Nov 2011 08:29:05 +0000 (08:29 +0000)]
Enable PCI MMC/SD support by default on i386 and amd64

12 years agoAdd 802.11h quiet time element support into net80211.
Adrian Chadd [Tue, 8 Nov 2011 04:00:24 +0000 (04:00 +0000)]
Add 802.11h quiet time element support into net80211.

This supports both station and hostap modes:

* Station mode quiet time element support listens to quiet time
  IE's and modifies the local quiet time configuration as appropriate;
* Hostap mode both obeys the locally configured quiet time period
  and includes it in beacon frames so stations also can obey as needed.

Submitted by: Himali Patel <himali.patel@sibridgetech.com>
Sponsored by: Sibridge Technologies

12 years agoBegin merging in some of my 802.11n TX aggregation driver changes.
Adrian Chadd [Tue, 8 Nov 2011 02:12:11 +0000 (02:12 +0000)]
Begin merging in some of my 802.11n TX aggregation driver changes.

* Add a PCU lock, which isn't currently used but will eventually be
  used to serialise some of the driver access.

* Add in all the software TX aggregation state, that's kept per-node
  and per-TID.

* Add in the software and aggregation state to ath_buf.

* Add in hooks to ath_softc for aggregation state and the (upcoming)
  aggregation TX state calls.

* Add / fix the HAL access macros.

Obtained from: Linux, ath9k
Sponsored by: Hobnob, Inc.

12 years agoBring over the 11n aggregation statistics struct from the if_ath_tx branch.
Adrian Chadd [Tue, 8 Nov 2011 01:35:44 +0000 (01:35 +0000)]
Bring over the 11n aggregation statistics struct from the if_ath_tx branch.

12 years agoMerge in ath rate flags and ath_rc_series from my 11n TX branch.
Adrian Chadd [Tue, 8 Nov 2011 01:35:05 +0000 (01:35 +0000)]
Merge in ath rate flags and ath_rc_series from my 11n TX branch.
This is in preparation for 802.11n TX aggregation support.