Commit Graph

32732 Commits

Author SHA1 Message Date
Sepherosa Ziehau
faaba341e5 hyperv/vmbus: Zero out GPADL if error happens.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8601
2016-11-28 04:53:36 +00:00
Adrian Chadd
0ffc652e9e [ath] fix target beacon interval programming for STA mode when in powersave.
This bug has been bugging me for quite some time.  I finally sat down
with enough coffee to figure it out.

The short of it - rounding up to the next intval multiple of the TSF value
only works if the AP is transmitting all its beacons on an interval of
the TSF.  If it isn't - for example, doing staggered beacons on a multi-VAP
setup with a single hardware TSF - then weird things occur.

The long of it -

When powersave is enabled, the MAC and PHY are partially powered off.
They can't receive any packets (or transmit, for that matter.)
The target beacon timer programming will wake up the MAC/PHY just before
the beacon is supposed to be received (well, strictly speaking, at DTIM
so it can see the TIM - traffic information map - telling the STA whether
any traffic is there for it) and it happens automatically.

However, this relies on the target beacon time being programmed correctly.
If it isn't then the hardware will wake up and not hear any beacons -
and then it'll be asleep for said beacons.  After enough of this, net80211
will give up and assume the AP went away.

This should fix both TSFOOR interrupts and disconnects from APs with powersave
enabled.

The annoying bit is that it only happens if APs stagger things or start
on a non-zero TSF.  So, this would sometimes be fine and sometimes not be
fine.

What:

* I don't know (yet) why the code rounds up to the next intval.
  For now, just disable rounding it and trust the value we get.

TODO:

* If we do see a beacon miss in STA mode then we should transition
  out of sleep for a while so we can hear beacons to resync against.
  I'd love a patch from someone to enable that particular behaviour.
  Note - that doesn't require that net80211 brings the chip out of
  sleep state - only that we wake the chip up through to full-on and
  then let it go to sleep again when we've seen a beacon.  The wifi
  stack and AP can still completely just stay believing we're in sleep
  mode.

Tested:

* AR9485, STA mode, powersave enabled

MFC after:	1 week
Relnotes:	Yes
2016-11-28 02:59:33 +00:00
Adrian Chadd
dc87d07103 [ath] include logging of TU versions of the TSF values.
The beacon programming side of things deals in TUs and 1/8th TUs, so
it's good to se the TU value here when debugging beaconing issues.
2016-11-28 02:51:55 +00:00
Adrian Chadd
5566fb10ee [ath] Begin to lay the groundwork for btcoex related ioctl controls. 2016-11-27 18:34:29 +00:00
Andriy Voskoboinyk
935b4fcccd rsu: add support for hardware multicast filter setup.
The algorithm is the same as in rtwn(4).

Tested with Asus USB-N10 (STA) + RTL8188CUS (AP).
2016-11-27 18:06:03 +00:00
Hans Petter Selasky
c0f71e317b Fix spelling. 2016-11-27 12:04:54 +00:00
Andriy Voskoboinyk
5dbbb84e42 rsu: various scanning fixes.
- Set IEEE80211_FEXT_SCAN_OFFLOAD flag; firmware can send null data
frames when associated.
- Check IEEE80211_SCAN_ACTIVE scan flag instead of IEEE80211_F_ASCAN
ic flag; the last is never set since r170530.
- Eliminate software scan (net80211) <-> site_survey (driver) race:
 * override ic_scan_curchan and ic_scan_mindwell pointers so net80211
will not try to finish scanning automatically;
 * inform net80211 about current status via ieee80211_cancel_scan()
and ieee80211_scan_done();
 * remove corresponding workaround from rsu_join_bss().

Now the driver can associate to an AP with hidden SSID.

Tested with Asus USB-N10.
2016-11-27 12:03:34 +00:00
Landon J. Fuller
77cb4d3e50 bhnd(4): Unify NVRAM/SPROM parsing, implement compact SPROM layout encoding.
- Defined an abstract NVRAM I/O API (bhnd_nvram_io), decoupling NVRAM/SPROM
  parsing from the actual underlying NVRAM data provider (e.g. CFE firmware
  devices).
- Defined an abstract NVRAM data API (bhnd_nvram_data), decoupling
  higher-level NVRAM operations (indexed lookup, data conversion, etc) from
  the underlying NVRAM file format parsing/serialization.
- Implemented a new high-level bhnd_nvram_store API, providing indexed
  variable lookup, pending write tracking, etc on top of an arbitrary
  bhnd_nvram_data instance.
- Migrated all bhnd(4) NVRAM device drivers to the common bhnd_nvram_store
  API.
- Implemented a common bhnd_nvram_val API for parsing/encoding NVRAM
  variable values, including applying format-specific behavior when
  converting to/from the NVRAM string representations.
- Dropped the now unnecessary bhnd_nvram driver, and moved the
  broadcom/mips-specific CFE NVRAM driver out into sys/mips/broadcom.
- Implemented a new nvram_map file format:
        - Variable definitions are now defined separately from the SPROM
          layout. This will also allow us to define CIS tuple NVRAM
          mappings referencing the common NVRAM variable definitions.
        - Variables can now be defined within arbitrary named groups.
        - Textual descriptions and help information can be defined inline
          for both variables and variable groups.
        - Implemented a new, compact encoding of SPROM image layout
          offsets.
- Source-level (but not build system) support for building the NVRAM file
  format APIs (bhnd_nvram_io, bhnd_nvram_data, bhnd_nvram_store) as a
  userspace library.

The new compact SPROM image layout encoding is loosely modeled on Apple
dyld compressed LINKEDIT symbol binding opcodes; it provides a compact
state-machine encoding of the mapping between NVRAM variables and the SPROM
image offset, mask, and shift instructions necessary to decode or encode
the SPROM variable data.

The compact encoding reduces the size of the generated SPROM layout data
from roughly 60KB to 3KB. The sequential nature SPROM layout opcode tables
also simplify iteration of the SPROM variables, as it's no longer
neccessary to iterate the full NVRAM variable definition table, but
instead simply scan the SPROM revision's layout opcode table.

Approved by:    adrian (mentor)
Differential Revision:  https://reviews.freebsd.org/D8645
2016-11-26 23:22:32 +00:00
Andriy Voskoboinyk
babfcab670 rsu: fix R92S_TXDW1_QSEL_H2C definition (0x1f -> 0x13).
Without this fix firmware ignores all but first 32 commands
(= almost everything (except plain Tx / Rx) stops working).

Tested with ASUS USB-N10.
2016-11-26 20:26:29 +00:00
Sepherosa Ziehau
2641e75742 hyperv/vmbus: Add a simplified version of channel close.
So that the caller can know the channel close error and react accordingly.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8600
2016-11-25 09:13:10 +00:00
Sepherosa Ziehau
892b35bc36 hyperv/vmbus: Propagate close error.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8599
2016-11-25 08:57:52 +00:00
Sepherosa Ziehau
0743140a63 hyperv/vmbus: Always try disconnect/free bufring memory upon channel close
While I'm here, minor wording and style changes.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8598
2016-11-25 08:31:13 +00:00
Sepherosa Ziehau
f2aeeaff6f hyperv/vmbus: Don't free the bufring if its GPADL can't be disconnected.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8570
2016-11-25 07:41:42 +00:00
Sepherosa Ziehau
32ab625a61 hyperv/vmbus: Return EISCONN if the bufring GPADL can't be disconnected.
So that the callers of vmbus_chan_open_br() could handle the passed in
bufring memory properly.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8569
2016-11-25 07:24:11 +00:00
Sepherosa Ziehau
12fbfdab73 hyperv/vmbus: No stranded bufring GPADL is allowed.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8568
2016-11-25 07:03:45 +00:00
Sepherosa Ziehau
11629f1cd6 hyperv/vmbus: GPADL disconnect error on a revoked channel is benign.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8567
2016-11-25 06:48:53 +00:00
Sepherosa Ziehau
fd2b520f2f hyperv/vmbus: Don't close unopened channels.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8566
2016-11-25 06:12:18 +00:00
Sepherosa Ziehau
ba9238f89f hyperv/vmbus: Fix sysctl tree leakage, if channel open fails.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8565
2016-11-25 06:01:45 +00:00
Sepherosa Ziehau
6d147fc18b hyperv/vmbus: Minor style changes.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8564
2016-11-25 05:46:15 +00:00
Sepherosa Ziehau
eb812ea9ab hyperv/vmbus: Commit the GPADL id only after the connection succeeds.
Minor style change.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8563
2016-11-25 05:35:29 +00:00
Dexuan Cui
cdb316ee87 hyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined
vmbus_pcib requires NEW_PCIB, but in case that's not defined, we at
least shouldn't break build.

Reviewed by:	sephe
Approved by:	sephe (mentor)
MFC after:	3 days
Sponsored by:	Microsoft
2016-11-25 04:35:40 +00:00
Andriy Gapon
18ec6fbc3a virtio_pci: fix announcement of MSI-X interrupts for queues
Queues that do not need interrupts - for instance, output queues - do
not have a corresponding entry in vtpci_msix_vq_interrupts.
So, it was wrong to increment a pointer into that array when iterating
over such a queue.

I ran into this bug while trying to use virtio_console(4) that allocates
a lot of queues with every other being an output queue without an
interrupt handler (if MultiplePorts feature is negotiated).

MFC after:	2 weeks
2016-11-24 21:32:04 +00:00
Andriy Gapon
8be1b98cae virtio_console: correctly determine presense of payload and its length
MFC after:	2 weeks
2016-11-24 21:12:32 +00:00
Andriy Gapon
810f2b5030 firewire: initialize tag label to -1 in fw_xfer_alloc()
Zero can be confused for a potentially valid value.
For example, if I load and unload sbp driver I get a lot of messages
like the following:

fw_tl_free: the xfer is not in the queue (tlabel=0, flag=0x0)
send: dst=0x00 tl=0x00 rt=0 tcode=0x0 pri=0x0 src=0x000
recv: dst=0x01 tl=0x21 rt=1 tcode=0x1 pri=0x0 src=0xffc0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe04464407e0
fw_tl_free() at fw_tl_free+0x18d/frame 0xfffffe0446440820
fw_xfer_unload() at fw_xfer_unload+0xca/frame 0xfffffe0446440840
fw_xferlist_remove() at fw_xferlist_remove+0x2f/frame 0xfffffe0446440870
sbp_detach() at sbp_detach+0x1e0/frame 0xfffffe04464408e0
device_detach() at device_detach+0x80/frame 0xfffffe0446440900
devclass_driver_deleted() at devclass_driver_deleted+0x6a/frame 0xfffffe0446440940
devclass_delete_driver() at devclass_delete_driver+0x7d/frame 0xfffffe0446440980
driver_module_handler() at driver_module_handler+0xff/frame 0xfffffe04464409d0
module_unload() at module_unload+0x32/frame 0xfffffe04464409f0
linker_file_unload() at linker_file_unload+0x24b/frame 0xfffffe0446440a40
kern_kldunload() at kern_kldunload+0xbc/frame 0xfffffe0446440a70
amd64_syscall() at amd64_syscall+0x314/frame 0xfffffe0446440bf0
Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe0446440bf0

MFC after:	2 weeks
2016-11-24 09:47:56 +00:00
Andriy Gapon
dc6040d671 fwohci: report whether PhysicalUpperBound register is implemented
Please see section 5.15 of 1394 OHCI Specification.
If the register is not implemented, then the physical response unit is
limited to the first 4GB of the physical memory.
In that case the non-cooperative debugging over firewire (using /dev/fwmem)
can not be expected to work if a target has more RAM than that.
The method is described in gdb.4 and the Developer's Handbook.

It seems that most of the consumer hardware does not implement
PhysicalUpperBound register.

MFC after:	1 week
2016-11-24 09:43:42 +00:00
Sepherosa Ziehau
25641fc705 hyperv/hn: Fix primary channel revocation
Since hypervisor will not drain the TX bufring, once the channels are
revoked:
- Setup vmbus orphan handler properly.
- Make sure that suspension will not wait the TX bufring draining
  forever.
- GC the pending TX descs on detach path, before freeing the busdma
  stuffs.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8559
2016-11-24 07:35:16 +00:00
Sepherosa Ziehau
91955558f5 hyperv/vmbus: Fix the multi-channel revoking on vmbus side.
- Reference count the sub-channel when channel offer message is
  processed, so that immediate rescind message on the same channel
  will not race sub-channel open on driver side.
- Drop the above reference when sub-channel is closed, this closely
  mimics the hypervisor's reaction when primary channel is closed
  on the VM side.  No drivers use sub-channel after primary channel
  is closed.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8546
2016-11-24 06:01:29 +00:00
Sepherosa Ziehau
5ab84aaf2f hyperv/vmbus: Fix the primary channel revoking on vmbus side.
Drivers can now use vmbus_chan_{is_revoked,set_orphan,unset_orphan}() and
vmbus_xact_ctx_orphan() to fix their attach/detach DEVMETHODs for revoked
primary channels.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8545
2016-11-24 05:18:45 +00:00
Sepherosa Ziehau
494ec41ae2 hyperv/vmbus: Implement orphan support for transaction API
It will be used to fix the primary channel revocation support.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8525
2016-11-24 04:58:13 +00:00
Stephen Hurd
8882bc0eb7 Add new device IDs
Add device IDs for new hardware, sort the device IDs, add comment
regarding fragice NPAR/VF detection.

Approved by:	davidch
MFC after:	6 days
Sponsored by:	Broadcom Limited
2016-11-24 00:49:00 +00:00
Stephen Hurd
0535a446ab Fix version string
This is no longer on github, but in FreeBSD base.

Approved by:	davidch
MFC after:	6 days
Sponsored by:	Broadcom Limited
2016-11-24 00:15:32 +00:00
Sepherosa Ziehau
713ff628ac hyperv/vmbus: Merge free/active locks.
These functions are only used by management stuffs, so there are
no needs to introduce extra complexity.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8524
2016-11-23 08:30:02 +00:00
Sepherosa Ziehau
fb6216bd43 hyperv/vmbus: Set a mark on the revoked channel.
This will be used to fix device detach DEVMETHOD for revoked primary
channel.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8522
2016-11-23 05:03:44 +00:00
Stephen Hurd
200b12cd44 Add missing break to switch statement
Minimal impact, would allow selection of LR media when KR is connected.

Reported by:	Coverity
Approved by:	davidch
MFC after:	7 days
Sponsored by:	Broadcom Limited
2016-11-23 00:26:31 +00:00
Adrian Chadd
c969f82d85 [ath] obey the peer A-MPDU density and max-size.
* Obey the peer A-MPDU density if it's larger than the currently configured
  one.

* Pay attention to the peer A-MPDU max-size and don't assume we can transmit
  a full A-MPDU (64k!) if the peer announces smaller values.

Relnotes:	ath(4): Fix A-MPDU transmit; obey A-MPDU density and max size.
2016-11-22 02:42:00 +00:00
Oleksandr Tymoshenko
fd98051117 [bytgpio] prepare bytgpio(4) for modularization
- Add detach method
- module should depend on gpiobus, not gpio
2016-11-21 19:43:01 +00:00
Andrew Turner
ef022bb1de Include the missing accommon.h from the ACPI uart code.
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-11-21 19:38:57 +00:00
Andrew Turner
eba1a249df Add support to find the arm64 serial using the ACPI tables. This uses the
Serial Port Console Redirection Table to find the device to use.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-11-21 19:26:58 +00:00
Michael Zhilin
b15317c431 [etherswitch] add ukswitch hint that is phy offset at mdio register
This patch allows to specify PHY register offset for ukswitch. For instance,
switch MAICREL KS8995XA connected via MDIO to SoC, but PHY register starts
at 1. So hint for this case is: hint.ukswitch.0.phyoffset=1

No change/effect if hint is not set.

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by:	adrian, mizhka
Approved by:	adrian(mentor)
Differential Revision:	https://reviews.freebsd.org/D8584
2016-11-21 19:26:22 +00:00
Andrew Turner
f94f8e62ab To allow for an ACPI attachment to the generic PCIe driver split off the
FDT attachment to a new file. A separate ACPI attachment will then be added
to allow arm64 servers with ACPI to use it over FDT.

This should also help with merging this with the ofwpci driver, with
further work needed to remove restrictions this driver places on resource
allocation.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7319
2016-11-21 18:24:05 +00:00
Sean Bruno
cb3c7e7f93 Add Intel Atom Cherryview SOC HSUART support
PR:	207910
Submitted by:	johannes@brilliantservice.co.jp
MFC after:	1 week
2016-11-21 14:43:31 +00:00
Andrew Turner
0812ab3141 Add an arm64 specific uart cpu driver. As arm64 may use ACPI to find the
uart we need to handle both it and FDT, and as such we need to have an
architecture specific driver.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7796
2016-11-21 11:27:14 +00:00
Kevin Lo
f55d404d45 Update struct r12a_rom.
Reviewed by:	avos
2016-11-21 09:23:42 +00:00
Sepherosa Ziehau
a7ba764844 hyperv/hn: Don't abuse hn_{tx,rx}_ring_inuse.
Just in case, the # of TX/RX rings is changed upon synthetic parts
re-attach.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8520
2016-11-21 05:54:31 +00:00
Sepherosa Ziehau
7960e6ba99 hyperv/hn: Allow enabling IPv6 TX checksum offloading and IPv6 TSO.
They are still disabled by default.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8490
2016-11-21 05:41:08 +00:00
Sepherosa Ziehau
fdc4f478ed hyperv/hn: Fix WITNESS warnings
And re-enable SIOCADDMULTI/SIOCDELMULTI, after WITNESS warning is fixed.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8489
2016-11-21 05:21:15 +00:00
Sepherosa Ziehau
8f3bf5f97b hyperv/vmbus: Support transction result busy-wait.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8488
2016-11-21 05:09:43 +00:00
Sepherosa Ziehau
dc13fee60c hyperv/hn: Implement RNDIS multi-packet message support.
Currently, it is only applied to packet sent through chimney sending
buffers.  Not enabled by default yet.

This one gives 20%~30% performance boost for non-TSO usage in both
bit/packet rate tests and nginx performance test.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8560
2016-11-21 05:00:51 +00:00
Oleksandr Tymoshenko
06ae3ba328 [bytgpio] Fix USB disconnect event after listsing pins on gpioc2
- Do not set input flag when reading value from GPIO pin, it is not
  required and for gpioc2(S5 bank) setting both input and output flags
  leads to some kind of electric interference (curren drop?) that
  causes USB devices to disconnect

- Check pad configuration when attaching device and provide IN/OUT
  capabilities only for pads that are configured as GPIO. Do not let
  user code to configure or change value of non-GPIO pads. There is
  no information for NC bank in intel's datasheet so for now function
  check is ignored for pins in it

Reported by:	Frank H.
MFC after:	3 days
2016-11-20 18:38:32 +00:00
Emmanuel Vadot
dac458e0d6 Enable the use of spigen on FDT platform
MFC after:	2 weeks
2016-11-20 18:20:28 +00:00