]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r319506, r319872, r321063, r321103, r321179, r321390, r321435,
np [Sat, 3 Mar 2018 02:30:52 +0000 (02:30 +0000)]
MFC r319506, r319872, r321063, r321103, r321179, r321390, r321435,
r321582, r321671, r322014, r322034, r322055, r322123, r322167, r322425,
r322549, r322914, r322960, r322962, r322964, r322985, r322990, r323006,
r323026, r323041, r323069, r323078, r323343, r323514, r323520, r324296,
r324379, r324386, r324443, r324945, r325596, r325680, r325880,
r325883-r325884, r325961, r326026, r326042, r327062, r327093, r327332,
r327528, r328420, and r328423.

r319506:
cxgbe(4): Update the statistics for compound tx work requests once per
work request, not once per frame.

r319872:
cxgbe(4):  Do not request an FEC setting that the port does not support.

r321063:
cxgbe(4): Various link/media related improvements.

- Deal with changes to port_type, and not just port_mod when a
  transceiver is changed.  This fixes hot swapping of transceivers of
  different types (QSFP+ or QSA or QSFP28 in a QSFP28 port, SFP+ or
  SFP28 in a SFP28 port, etc.).

- Always refresh media information for ifconfig if the port is down.
  The firmware does not generate tranceiver-change interrupts unless at
  least one VI is enabled on the physical port.  Before this change
  ifconfig diplayed potentially stale information for ports that were
  administratively down.

- Always recalculate and reapply L1 config on a transceiver change.

- Display PAUSE settings in ifconfig.  The driver sysctls for this
  continue to work as well.

r321103:
cxgbe(4): New ioctls to flash bootrom and boot config to the card.

r321179:
cxgbe/t4_tom: Log more details about the newly ESTABLISHED tid to the
trace buffer.

r321390:
cxgbe(4): Install the firmware bundled with the driver to the card if it
doesn't seem to have one.  This lets the driver recover automatically
from incomplete firmware upgrades (panic, reboot, power loss, etc. in
the middle of an upgrade).

r321435:
cxgbe(4): Display some more TOE parameters related to retransmission
and keepalive in the sysctl MIB.  Provide tunables to change some of
these parameters.  These are supposed to be setup by the firmware so
these tunables are for experimentation only.

r321582:
cxgbe(4): Some updates to the common code.

- Updated register ranges.
- Helper routines for access to TP registers.
- Updated routine to read flash parameters.

r321671:
cxgbe/iw_cxgbe: Log the end point's history and flags to the trace
buffer just before it's freed.

r322014:
cxgbe(4): Initial import of the "collect" component of Chelsio unified
debug (cudbg) code, hooked up to the main driver via an ioctl.

The ioctl can be used to collect the chip's internal state in a
compressed dump file.  These dumps can be decoded with the "view"
component of cudbg.

r322034:
cxgbe(4): Always use the first and not the last virtual interface
associated with a port in begin_synchronized_op.

r322055:
cxgbe(4): Allow the TOE timer tunables to be set with microsecond
precision.  These timers are already displayed in microseconds in the
sysctl MIB.  Add variables to track these tunables while here.

r322123:
cxgbe(4): Avoid a NULL dereference that would occur during module unload
if there were problems earlier during attach.

r322167:
cxgbe(4): Add the T6 and T5 Unified Wire configuration files to the
kernel, just like for T4, when the driver is compiled into the kernel.

r322425:
cxgbe(4): Save the last reported link parameters and compare them with
the current state to determine whether to generate a link-state change
notification.  This fixes a bug introduced in r321063 that caused the
driver to sometimes skip these notifications.

r322549:
cxgbe/t4_tom: Use correct name for the ISS-valid bit in options2.

r322914:
cxgbe(4): Dump the mailbox contents in the same format as CH_DUMP_MBOX.

r322960:
cxgbe(4): Verify that the driver accesses the firmware mailbox in a
thread-safe manner.

r322962:
cxgbe(4): Remove write only variable from t4_port_init.

r322964:
cxgbe(4): vi_mac_funcs should include the base Ethernet function.  It is
already used in the driver as if it does.

r322985:
cxgbe(4): Maintain one ifmedia per physical port instead of one per
Virtual Interface (VI).  All autonomous VIs that share a port share the
same media.

r322990:
cxgbe(4): Do not access the mailbox without appropriate locks while
creating hardware VIs.

This fixes a bad race on systems with hw.cxgbe.num_vis > 1.

r323006:
cxgbe(4): Update T6/T5/T4 firmwares to 1.16.59.0.

r323026:
cxgbe(4): Zero out the memory allocated for the debug dump.
cudbg_collect seems to expect it this way.

r323041:
cxgbe(4): Add two new debug flags -- one to allow manual firmware
install after full initialization, and another to disable the TCB
cache (T6+).  The latter works as a tunable only.

Note that debug_flags are for debugging only and should not be set
normally.

r323069:
cxgbe/t4_tom: Add a knob to select the congestion control algorigthm
used by the TOE hardware for fully offloaded connections.  The knob
affects new connections only.

r323078:
cxgbe/t4_tom: There may not be a tid to update if the connection isn't
established.

r323343:
cxgbe(4): Fix a couple of problems in the sge_wrq data path.

- start_wrq_wr must not drain the wr_list if there are incomplete_wrs
  pending.  This can happen when a t4_wrq_tx runs between two
  start_wrq_wr.

- commit_wrq_wr must examine the cookie's pidx and ndesc with the
  queue's lock held.  Otherwise there is a bad race when incomplete WRs
  are being completed and commit_wrq_wr for the WR that is ahead in the
  queue updates the next incomplete WR's cookie's pidx/ndesc but the
  commit_wrq_wr for the second one is using stale values that it read
  without the lock.

r323514:
cxgbetool(8): mode must be specified when creating the dump file.

r323520:
cxgbe(4): Ignore capabilities that depend on TOE when the firmware
reports TOE is not available.

r324296:
cxgbe(4): Provide knobs to set the holdoff parameters of TOE rx queues
separately from NIC rx queues instead of using the same parameters for
both types of queues.

r324379:
cxgbetool(8): Do not create a large file devoid of useful content when
the dumpstate ioctl fails.  Make the file world-readable while here.

r324386:
cxgbe(4): Update T6, T5, and T4 firmwares to 1.16.63.0.

r324443:
cxgbetool(8): Do not close uninitialized fd on malloc failure.

r324945:
cxgbe(4): Read the MPS buffer group map from the firmware as it could be
different from hardware defaults.  The congestion channel map, which is
still fixed, needs to be tracked separately now.  Change the congestion
setting for TOE rx queues to match the drivers on other OSes while here.

r325596:
cxgbe(4): Do not request settings not supported by the port.

r325680:
cxgbe(4): Excluce mdi from the check against port capabilities.

r325880:
cxgbe(4):  Combine all _10g and _1g tunables and drop the suffix from
their names.  The finer-grained knobs weren't practically useful.

r325883:
cxgbe(4): Sanitize t4_num_vis during MOD_LOAD like all other t4_*
tunables.  Add num_vis to the intrs_and_queues structure as it affects
the number of interrupts requested and queues created.  In future
cfg_itype_and_nqueues might lower it incrementally instead of going
straight to 1 when enough interrupts aren't available.

r325884:
cxgbe(4): Remove rsrv_noflowq from intrs_and_queues structure as it does
not influence or get affected by the number of interrupts or queues.

r325961:
cxgbe(4): Add core Vdd to the sysctl MIB.

r326026:
cxgbe(4): Add a custom board to the device id list.

r326042:
cxgbe(4): Fix unsafe mailbox access in cudbg.

r327062:
cxgbe(4):  Read the MFG diags version from the VPD and make it available
in the sysctl MIB.

r327093:
cxgbe(4): Do not forward interrupts to queues with freelists.  This
leaves the firmware event queue (fwq) as the only queue that can take
interrupts for others.

This simplifies cfg_itype_and_nqueues and queue allocation in the driver
at the cost of a little (never?) used configuration.  It also allows
service_iq to be split into two specialized variants in the future.

r327332:
cxgbe(4): Reduce duplication by consolidating minor variations of the
same code into a single routine.

r327528:
cxgbe(4): Add a knob to enable/disable PCIe relaxed ordering.  Disable it by
default when running on Intel CPUs.

r328420:
cxgbe(4): Do not display harmless warning in non-debug builds.

r328423:
cxgbe(4): Accept old names of a couple of tunables.

Sponsored by: Chelsio Communications

6 years agoMFC 328608: Export tcp_always_keepalive for use by the Chelsio TOM module.
jhb [Sat, 3 Mar 2018 00:54:12 +0000 (00:54 +0000)]
MFC 328608: Export tcp_always_keepalive for use by the Chelsio TOM module.

This used to work by accident with ld.bfd even though always_keepalive
was marked as static. LLD honors static more correctly, so export this
variable properly (including moving it into the tcp_* namespace).

Relative to HEAD the MFC includes two additional changes:
- The t3_tom module used for cxgb(4) is also patched.
- A strong reference from the new name (tcp_always_keepalive) to the old
  name (always_keepalive) has been added to preserve the KBI for existing
  modules.

Suggested by: kib (strong reference)
Sponsored by: Chelsio Communications

6 years agoMFC r328314:
np [Sat, 3 Mar 2018 00:22:32 +0000 (00:22 +0000)]
MFC r328314:

Do not generate illegal mbuf chains during IP fragment reassembly.  Only
the first mbuf of the reassembled datagram should have a pkthdr.

6 years agoMFC r323221:
np [Sat, 3 Mar 2018 00:10:37 +0000 (00:10 +0000)]
MFC r323221:

Make LACP based lagg work with interfaces (like 100Gbps and 25Gbps) that
report extended media types.

lacp_aggregator_bandwidth() uses the media to determine the speed of the
interface and returns 0 for IFM_OTHER without the bits in the extended
range.

Reported by: kbowling@
Reviewed by: eugen_grosbein.net, mjoras@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D12188

6 years agoMFC r320943-r320944, r321008, r321072, r321128
manu [Fri, 2 Mar 2018 15:17:42 +0000 (15:17 +0000)]
MFC r320943-r320944, r321008, r321072, r321128

r320943:
Add ipfw_status command to etc/rc.d/ipfw

This is helpful when using service/conf management tools.

Sonsored-By: Gandi.net

r320944:
Add an rc.d script to setup a netflow export via ng_netflow
The default is to export netflow data on localhost on the netflow port.
ngtee is used to have the lowest overhead possible.
The ipfw ng hook is the netflow port (it can only be numeric)
Default is netflow version 5.

Sponsored-By: Gandi.net
Reviewed by: bapt (earlier version), olivier (earlier version)

r321008:
etc/rc.d: Only install ipfw_netflow is MK_IPFW and MK_NETGRAPH is defined

While here only install ipfw rc script if MK_IPFW is defined.

Reported by: ngie

r321072:
ipfw_netflow: add +ipfw_netflow_enable="NO" to defaults/rc.conf and document
usage in rc.conf(5)

Reported by: markj
Sponsored by: Gandi.net

r321128:
ipfw_netflow: Add support for FIB

If ipfw_netflow_fib, the ipfw rule will only match packets in that FIB.

While here correct some value in rc.conf(5) to be int and not str.

Sponsored by: Gandi.net

6 years agoMFC r329864:
kib [Fri, 2 Mar 2018 10:57:46 +0000 (10:57 +0000)]
MFC r329864:
Do not return out of bound pointers from intr_lookup_source().

6 years agoMFC of 329880.
mckusick [Fri, 2 Mar 2018 04:41:52 +0000 (04:41 +0000)]
MFC of 329880.

Add error number to "fsync: giving up on dirty" message.

6 years agoMFC r330033:
gjb [Thu, 1 Mar 2018 16:41:37 +0000 (16:41 +0000)]
MFC r330033:
 Bump the size of virtual machine disk images from 20G to 30G,
 providing more space for a local buildworld to succeed without
 attaching separate disks for /usr/src and /usr/obj.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r314077:
eadler [Thu, 1 Mar 2018 16:03:13 +0000 (16:03 +0000)]
MFC r314077:

Add 7265D firmware.

6 years agoRevert MFC of r330233
eadler [Thu, 1 Mar 2018 15:21:52 +0000 (15:21 +0000)]
Revert MFC of r330233

This was an additional commit that I did not intend to MFC... and also
broke the build

Pointy Hat To: me

6 years agoMFC r329314: MFV r329313: 8857 zio_remove_child() panic due to already destroyed...
avg [Thu, 1 Mar 2018 10:35:05 +0000 (10:35 +0000)]
MFC r329314: MFV r329313: 8857 zio_remove_child() panic due to already destroyed parent zio

PR: 223803

6 years agoMFC r329711: MFV r329710: 8966 use after end of the lifetime of a local variable
avg [Thu, 1 Mar 2018 08:33:20 +0000 (08:33 +0000)]
MFC r329711: MFV r329710: 8966 use after end of the lifetime of a local variable

PR: 225162

6 years agoMFC r324570,r324580:
eadler [Thu, 1 Mar 2018 08:05:52 +0000 (08:05 +0000)]
MFC r324570,r324580:

[net80211] begin handling multiple hardware decap'ed A-MSDU in the RX path.

The duplicate detection code currently expects A-MSDU frames to be encaped -
they're decap'ed /after/ duplicate detection.

However for ath10k (and iwm hardware later on) the firmware supports
doing A-MSDU decap in hardware - which shows up as multiple frames with
the same sequence number and IV.

This is the first part of decap handling - if we see a stretch of A-MSDU
frames from the driver with the MORE bit set, then don't treat them
as duplicates.

This isn't 100% complete as crypto sequence number handling and "A-MSDU in
A-MPDU" needs handling, but it's a start.

This should be a glorified no-op for everyone.  Please tell me if it isn't.

6 years agoMFC r307602:
eadler [Thu, 1 Mar 2018 07:59:14 +0000 (07:59 +0000)]
MFC r307602:

[net80211] Initial full-offload scan support.

This is a very simple addition to the net80211 scan support.

It doesn't implement a replacement scan interface - it just disables
the pieces that we should disable to make this lifecycle a bit
more managable.

There's more work to come before full scan offload support is available
but it should be good enough for driver work.

* add a flag to say "full offload"
* don't do probe requests when scanning full-offload - firmware can do that
* don't do powersave transitions and buffering - firmware can do that

tested:

* iwm(4) - STA mode
* ath10k port (local, not in freebsd-head yet)

6 years agoMFC r314080:
eadler [Thu, 1 Mar 2018 07:55:48 +0000 (07:55 +0000)]
MFC r314080:

6 years agoMFC r313419,r313420,r313421,r313423,r313426,r313428,r314078,r314079,r319584,r319586...
eadler [Thu, 1 Mar 2018 07:42:20 +0000 (07:42 +0000)]
MFC r313419,r313420,r313421,r313423,r313426,r313428,r314078,r314079,r319584,r319586,r319588,r324469,r324470,r324435,r325122:

[iwmfw] add version 17 firmware.
[iwmfw] add version 17 firmware.
[iwmfw] add version 17 firmware.
[iwmfw] add this 3 megabyte firmware image.
[iwmfw] bump firmware to version 17.
[iwmfw] back this out to version 16 for now.
[iwmfw] add 7265D firmware.
[iwmfw] add 7265D firmware.
[iwmfw] add 7265D-22 firmware
[iwmfw] 8000C ver 22 firmware.
[iwmfw] bump built firmware now to version 22 for 7265D and 8000C.
[iwmfw] Add missing SUBDIR needed for iwmfw to load after ^/head@r324434
[iwmfw] Add the firmware for the Intel 8265 WiFi device.

6 years agoMFC r325122,r325124,r325125:
eadler [Thu, 1 Mar 2018 07:22:53 +0000 (07:22 +0000)]
MFC r325122,r325124,r325125:

Fill in the blanks for iwm8265fw(4) rules, missed in r324434

Now using "device iwmfw" or "device iwm8265fw" in one's kernel configuration
will potentially result in a working IWM8265 series wireless SoC.

This is an alternative to the fix that was made in r324470 for
`sys/modules/iwmfw`.

6 years agoMFC r325123:
eadler [Thu, 1 Mar 2018 07:18:28 +0000 (07:18 +0000)]
MFC r325123:

Reference iwm8265fw support in iwm(4) as well

This documentation update is similar to what was done in iwmfw(4) in r325121.

6 years agoMFC r324434:
eadler [Thu, 1 Mar 2018 06:57:38 +0000 (06:57 +0000)]
MFC r324434:

Add support for Intel 8265 WiFi

Obtained from: OpenBSD

6 years agoMFC r321511:
eadler [Thu, 1 Mar 2018 06:57:02 +0000 (06:57 +0000)]
MFC r321511:

[iwm] Sync rs (rate-selection) API definitions from Linux iwlwifi.

* While there clean up alignments and line wrapping in existing
  definitions for rs API in if_iwmreg.h

6 years agoMFC r321510:
eadler [Thu, 1 Mar 2018 06:56:34 +0000 (06:56 +0000)]
MFC r321510:

[iwm] Add iwm_mvm_send_lq_cmd() from Linux iwlwifi to if_iwm_util.c.

6 years agoMFC r321509:
eadler [Thu, 1 Mar 2018 06:56:10 +0000 (06:56 +0000)]
MFC r321509:

[iwm] Sync statistics API definitions with Linux iwlwifi.

6 years agoMFC r321508:
eadler [Thu, 1 Mar 2018 06:55:46 +0000 (06:55 +0000)]
MFC r321508:

[iwm] Cleanup mbufq draining. Add iwm_xmit_queue_drain() like in iwn(4).

* iwm_xmit_queue_drain() calls ieee80211_free_node(), removing a possible
  memory leak, compared to using just mbufq_drain().

* Remove duplicate mbufq_drain() from iwm_mvm_rm_sta(), this should be
  handled in the caller.

6 years agoMFC r319590:
eadler [Thu, 1 Mar 2018 06:54:03 +0000 (06:54 +0000)]
MFC r319590:

6 years agoMFC r319589:
eadler [Thu, 1 Mar 2018 06:53:37 +0000 (06:53 +0000)]
MFC r319589:

[iwm] Remove support for fw older than -17 and -22

* iwm(4) didn't use any of these definitions yet, anyway.

6 years agoMFC r319582:
eadler [Thu, 1 Mar 2018 06:50:34 +0000 (06:50 +0000)]
MFC r319582:

[iwm] Ignore IWM_DEBUG_LOG_MSG notifications.

* Firmware versions 21 and 22 generate some IWM_DEBUG_LOG_MSG notifications,
  which seem to be harmless. Avoid spamming the system log with
  "frame ... UNHANDLED (this should not happen)" messages.

6 years agoMFC r319581:
eadler [Thu, 1 Mar 2018 06:50:05 +0000 (06:50 +0000)]
MFC r319581:

[iwm] Set command code for PHY_DB as well.

6 years agoMFC r319579:
eadler [Thu, 1 Mar 2018 06:48:18 +0000 (06:48 +0000)]
MFC r319579:

[iwm] Remove dead code from iwm_pcie_load_cpu_sections().

* If device family is 8000 then iwm_pcie_load_cpu_sections()
  won't be called at all (iwm_pcie_load_cpu_sections_8000() is
  called in that case) so this piece of code never gets called.

6 years agoMFC r319578:
eadler [Thu, 1 Mar 2018 06:47:52 +0000 (06:47 +0000)]
MFC r319578:

[iwm] Check for lar_disable tunable, and lar_enabled flag from NVM.

* LAR can be disabled with the hw.iwm.lar.disable tunable now.

* On Family 8000 devices we need to check the lar_enabled flag from
  nvm_data in addition to the TLV_CAPA_LAR_SUPPORT flag from the firmware.

* Add a separate IWM_DEBUG_LAR debugging flag.

6 years agoMFC r318232:
eadler [Thu, 1 Mar 2018 06:46:56 +0000 (06:46 +0000)]
MFC r318232:

[iwm] Recognize IWM_FW_PAGING_BLOCK_CMD wide cmd response correctly.

6 years agoMFC r318230:
eadler [Thu, 1 Mar 2018 06:46:31 +0000 (06:46 +0000)]
MFC r318230:

[iwm] Fix iwm_mvm_send_cmd_pdu(_status) declarations. Make id a uint32_t.

* This fixes cases where the group id of wide commands got lost, e.g. this
  happened to the IWM_SCAN_ABORT_UMAC command.

6 years agoMFC r318231:
eadler [Thu, 1 Mar 2018 06:45:24 +0000 (06:45 +0000)]
MFC r318231:

[iwm] Revert "if_iwm - SCAN_ABORT_UMAC response doesn't use a wide id"

This reverts commit cef47a9cbb0a3ce5f18369fed9403d2764884bc2.

6 years agoMFC r318229:
eadler [Thu, 1 Mar 2018 06:44:32 +0000 (06:44 +0000)]
MFC r318229:

[iwm] Adjust if_iwm_sta.h prototypes, don't pass iwm_node to rm_sta().

* Since a RUN -> INIT/SCAN transition seems to immediately destroy the
  ieee80211_node for the AP, we can't read the in_assoc value from there.
  Instead just directly pass that information via a boolean_t argument.

* Adds iwm_mvm_rm_sta_id() function, which just unconditionally removes
  the station from the firmware.

* The iwm_mvm_rm_sta() function shouldn't actually remove the station from
  firmware when we are still associated (i.e. during a RUN -> INIT/SCAN
  transition).

 * So when disassociating we will first call iwm_mvm_rm_sta() to drain the
   queues/fifos. Later during disassociation we will then use
   iwm_mvm_rm_sta_id() to actually remove the station.

Inspired-By: Linux iwlwifi
6 years agoMFC r318224:
eadler [Thu, 1 Mar 2018 06:42:47 +0000 (06:42 +0000)]
MFC r318224:

[iwm] Refuse connection to APs with beacon interval < 16.

6 years agoMFC r318223:
eadler [Thu, 1 Mar 2018 06:42:19 +0000 (06:42 +0000)]
MFC r318223:

[iwm] Handle AUTH->SCAN/INIT and ASSOC->SCAN/INIT better

* Tear down the relevant firmware state (i.e. the station, the vif binding)
  in these transition cases.

* Before this case would leave the firmware state lying around, resulting
  in errors and firmware panics in the subsequent association attempts.

6 years agoMFC r318222:
eadler [Thu, 1 Mar 2018 06:41:35 +0000 (06:41 +0000)]
MFC r318222:

[iwm] Factor out firmware station handling into if_iwm_sta.c.

* This adds iwm_mvm_rm_sta(), which will be used to tear down firmware
  state for better/cleaner iwm_newstate() handling.

* Makes iwm_enable_txq() and iwm_mvm_flush_tx_path() non-static, add
  the declarations to if_iwm_util.h for now.

6 years agoMFC r318219:
eadler [Thu, 1 Mar 2018 06:40:08 +0000 (06:40 +0000)]
MFC r318219:

[iwm] Properly implement iwm_wme_update callback function.

* Inspired by iwn(4) and Linux iwlwifi.

* Read wme parameters into a buffer within struct iwm_vap in
  iwm_wme_update().

* If we aren't associated yet, the new settings will soon be sent
  by iwm_mvm_mac_ctxt_changed() during association.

* If we are already associated, explicitly call iwm_mvm_mac_ctxt_changed()
  from iwm_wme_update() to send the new settings to the firmware.

* Change iwm_mvm_ac_to_tx_fifo mapping, to fit the freebsd net80211
  WME stream class numbering, instead of Linux's enum ieee80211_ac_numbers.

6 years agoMFC r318218:
eadler [Thu, 1 Mar 2018 06:39:44 +0000 (06:39 +0000)]
MFC r318218:

[iwm] Process multiple frames per RX buffer.

* Factor out iwm_handle_rxb() function from iwm_notif_intr().

* Removing the IWM_FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK flag allows
  the device to put multiple frames (both command responses and 80211
  frames) into a single RX buffer.

* Uses m_copym() to split up the receive buffers when multiple 80211
  frames are received in one RX buffer. The effect is basically the same
  as when using m_split(), but we want to keep the original mbuf around
  when calling iwm_mvm_rx_rx_mpdu() to make error handling a bit easier
  for now.

* Contains a small optimization to avoid the m_copym() when only a single
  80211 frame is received in one RX buffer (i.e. matching the existing
  behaviour).

6 years agoMFC r318217:
eadler [Thu, 1 Mar 2018 06:39:14 +0000 (06:39 +0000)]
MFC r318217:

[iwm] Change UCODE_TLV_API #define-s from bitmasks to indexes.

* Fixes oversight from commit 757eecf0e6c92745aa2eee95811e573c8300850e.
  fw_has_api now uses the isset macro instead of a simple logical-and.

6 years agoMFC r318216:
eadler [Thu, 1 Mar 2018 06:38:42 +0000 (06:38 +0000)]
MFC r318216:

[iwm] Sync iwm_read_firmware()'s loop to iwlwifi's code.

6 years agoMFC r318215:
eadler [Thu, 1 Mar 2018 06:38:06 +0000 (06:38 +0000)]
MFC r318215:

[iwm] change the check for ADD_STA status, use IWM_ADD_STA_STATUS_MASK.

6 years agoMFC r318214:
eadler [Thu, 1 Mar 2018 06:36:41 +0000 (06:36 +0000)]
MFC r318214:

[iwm] Sanity check channel for IEEE80211_CHAN_ANYC in if_iwm_mac_ctxt.c.

* This avoids panicing in some broken vap state handling cases.

6 years agoMFC r318013:
eadler [Thu, 1 Mar 2018 06:35:13 +0000 (06:35 +0000)]
MFC r318013:

[iwm] Move in_phyctxt from struct iwm_node to phy_ctxt in struct iwm_vap.

* This better matches how things are organized in Linux's iwlwifi.

6 years agoMFC r318012:
eadler [Thu, 1 Mar 2018 06:34:48 +0000 (06:34 +0000)]
MFC r318012:

[iwm] Allow listening on both chains/atennas to get diversity.

This might improve throughput slightly when far from the accesspoint,
apparently by allowing the firmware to listen on either of the two
antennas (if there are two, i.e. on 7260/7265/8260), whichever has
a better reception.

6 years agoMFC r318005:
eadler [Thu, 1 Mar 2018 06:34:21 +0000 (06:34 +0000)]
MFC r318005:

[iwm] Add basic powermanagement support via ifconfig wlan0 powersave.

* The DEVICE_POWER_FLAGS_CAM_MSK flag was removed in the upstream iwlwifi
  in Linux commit ceef91c89480dd18bb3ac51e91280a233d0ca41f.

* Add sc_ps_disabled flag to struct iwm_softc, which corresponds to
  mvm->ps_disabled in struct iwl_mvm in Linux iwlwifi.

* Adds a hw.iwm.power_scheme tunable which corresponds to the power_scheme
  module parameter in Linux iwlwifi. Set this to 1 for completely
  disabling power management, 2 (default) for balanced powermanagement,
  and 3 for lowerpower mode (which does dtim period skipping).

* Imports the constants.h file from iwlwifi as if_iwm_constants.h.

* This doesn't allow changing the powermanagement setting while connected,
  also one can only choose between enabled and disabled powersaving with
  ifconfig (so switching between balanced and low-power mode requires
  rebooting to change the tunable).

* After any changes to powermanagement (i.e. "ifconfig wlan0 powersave" to
  enable powermanagement, or "ifconfig wlan0 -powersave" for disabling
  powermanagement), one has to disconnect and reconnect to the accespoint
  for the change to take effect.

6 years agoMFC r318003:
eadler [Thu, 1 Mar 2018 06:33:27 +0000 (06:33 +0000)]
MFC r318003:

[iwm] Add iwm_nic_unlock() calls missing from previous commit.

6 years agoMFC r318002:
eadler [Thu, 1 Mar 2018 06:32:46 +0000 (06:32 +0000)]
MFC r318002:

[iwm] iwm_{read,write}_prph() don't grab the nic lock in iwm themselves.

* Fix a couple of cases where the nic lock ended up not being grabbed
  during an iwm_read_prph() or iwm_write_prph().

6 years agoMFC r315926:
eadler [Thu, 1 Mar 2018 06:31:07 +0000 (06:31 +0000)]
MFC r315926:

[iwm] Add the BSS's basic rates to iwm's LQ command, not all the rates.

Makes the firmware use appropriate Tx rates for ACKs.

6 years agoMFC r315923:
eadler [Thu, 1 Mar 2018 06:29:02 +0000 (06:29 +0000)]
MFC r315923:

[iwm]  Tiny cleanup in iwm_rx_addbuf().

6 years agoMFC r315784:
eadler [Thu, 1 Mar 2018 06:27:39 +0000 (06:27 +0000)]
MFC r315784:

[iwm] Make ucode capabilities and api flags handling more like iwlwifi.

6 years agoMFC r315780:
eadler [Thu, 1 Mar 2018 06:27:10 +0000 (06:27 +0000)]
MFC r315780:

[iwm] Remove a couple of unneeded IWM_UCODE_TLV_FLAGS_* flags.

* All the supported firmwares have these flags set.

* This removes the following flags:
  IWM_UCODE_TLV_FLAGS_PM_CMD_SUPPORT,
  IWM_UCODE_TLV_FLAGS_NEWBT_COEX,
  IWM_UCODE_TLV_FLAGS_BF_UPDATED,
  IWM_UCODE_TLV_FLAGS_D3_CONTINUITY_API,
  IWM_UCODE_TLV_FLAGS_STA_KEY_CMD,
  IWM_UCODE_TLV_FLAGS_DEVICE_PS_CMD,
  IWM_UCODE_TLV_FLAGS_SCHED_SCAN,
  IWM_UCODE_TLV_FLAGS_RX_ENERGY_API,
  IWM_UCODE_TLV_FLAGS_TIME_EVENT_API_V2

* Also remove definitions and code for dealing with the v1 time-event api.

* Remove unneeded calc_rssi() function.

6 years agoMFC r315778:
eadler [Thu, 1 Mar 2018 06:25:03 +0000 (06:25 +0000)]
MFC r315778:

[iwm] Move mbuf hacks after sanity checks in iwm_mvm_rx_rx_mpdu().

* This avoids leaving the mbuf in a weird state, when dropping a packet.

6 years agoMFC r315777:
eadler [Thu, 1 Mar 2018 06:24:03 +0000 (06:24 +0000)]
MFC r315777:

[iwm]  Get rid of struct iwm_rx_data argument for iwm_mvm_rx_rx_mpdu.

6 years agoMFC r314192,r314209:
eadler [Thu, 1 Mar 2018 06:22:14 +0000 (06:22 +0000)]
MFC r314192,r314209:

[iwm] Add support for Firmware paging, needed for newer 8000C firmware.

* Uses the IWM_FW_PAGING_BLOCK_CMD firmware command to tell the firmware
  what memory ranges to use for paging.

6 years agoMFC r314082:
eadler [Thu, 1 Mar 2018 06:20:16 +0000 (06:20 +0000)]
MFC r314082:

[iwm] Move iwm_dma_contig_alloc/_free functions to if_iwm_util.c.

6 years agoMFC r314081:
eadler [Thu, 1 Mar 2018 06:19:53 +0000 (06:19 +0000)]
MFC r314081:

[iwm] Switch 7265D and 3165 devices to 7265D firmware.

6 years agoMFC 314151:
eadler [Thu, 1 Mar 2018 06:19:12 +0000 (06:19 +0000)]
MFC 314151:

Unbreak if_iwm.ko after r314076

Add if_iwm_7000.c/if_iwm_8000.c to SRCS to match similar additions made
to sys/conf/files after refactoring done in the commit noted.

PR: 217308
Pointyhat to: adrian
Submitted by: Andreas Nilsson <andrnils@gmail.com>
Reported by: Jakob Alvermark <jakob@alvermark.net>, Juan Ramómon Molina Menor <listjm@club.fr>

6 years agoMFC r314076:
eadler [Thu, 1 Mar 2018 06:18:27 +0000 (06:18 +0000)]
MFC r314076:

[iwm] Move struct iwm_cfg chipset configs to if_iwm_7000.c and _8000.c

* This is more similar to how code/definitions are distributed in
  Linux's iwlwifi.

* This should make recognizing new chipset variants, and adding additional
  flags from the Linux iwlwifi code easier, without blowing up if_iwm.c

6 years agoMFC r314074:
eadler [Thu, 1 Mar 2018 06:16:40 +0000 (06:16 +0000)]
MFC r314074:

[iwm] Simplify device id matching code a bit.

* Just add the struct iwm_cfg pointers to the iwm_devices array, to get
  rid of the large switch clause.

6 years agoMFC r314070:
eadler [Thu, 1 Mar 2018 06:16:11 +0000 (06:16 +0000)]
MFC r314070:

[iwm] Fix typo in commit a7697ea01c11fd493aec52260a02f31df680eb91.

* The sc->sc_uc.uc_error_event_table value is now at sc->error_event_table,
  and not sc->umac_error_event_table.

6 years agoMFC r314069:
eadler [Thu, 1 Mar 2018 06:15:01 +0000 (06:15 +0000)]
MFC r314069:

[iwm] Get rid of unneeded IWM_FWDMASEGSZ and IWM_FWMAXSIZE constants

* We only need IWM_FH_MEM_TB_MAX_LENGTH bytes for the fw_dma memory.

6 years agoMFC r314067:
eadler [Thu, 1 Mar 2018 06:14:09 +0000 (06:14 +0000)]
MFC r314067:

[iwm] With the previous commits, this DELAY no longer seems to be needed.

6 years agoMFC r314066:
eadler [Thu, 1 Mar 2018 06:13:01 +0000 (06:13 +0000)]
MFC r314066:

[iwm] Sync IWM_MVM_ALIVE waiting and start_fw handling with iwlwifi.

* Use the notification wait API, like it's done in the Linux iwlwifi code,
  to wait for the IWM_MVM_ALIVE notification.

* This also should fix some firmware load interrupt issues, and errors
  in the nic lock using.

Tested:

* (adrian) Intel 7260, STA mode

6 years agoMFC r314065:
eadler [Thu, 1 Mar 2018 06:01:33 +0000 (06:01 +0000)]
MFC r314065:

[iwm] Synchronize firmware loading code with Linux iwlwifi.

* While there, rename some functions to match the names and functionality
  of the similarly named functions in Linux iwlwifi.

6 years agoMFC r313430:
eadler [Thu, 1 Mar 2018 06:00:59 +0000 (06:00 +0000)]
MFC r313430:

[iwm] Remove 1s delay after fw loading. Can't reproduce issues on AC8260.

The 1s delay was added in the update to version 16 fw, where Family 8000
support was added.

6 years agoMFC r313429:
eadler [Thu, 1 Mar 2018 06:00:31 +0000 (06:00 +0000)]
MFC r313429:

[iwm] SCAN_ABORT_UMAC response doesn't use a wide id

6 years agoMFC r313427:
eadler [Thu, 1 Mar 2018 05:59:58 +0000 (05:59 +0000)]
MFC r313427:

[iwm] Recognize the IWM_UCODE_TLV_FW_MEM_SEG firmware section type.

* Will be needed for loading version 22 of 7265D firmware.

6 years agoMFC r313418:
eadler [Thu, 1 Mar 2018 05:58:53 +0000 (05:58 +0000)]
MFC r313418:

[iwm] Recognize IWM_DTS_MEASUREMENT_NOTIF_WIDE notification.

* Add the command groups enum, and the iwm_phy_ops_subcmd_ids enum
  to if_iwmreg.h definitions.

* The IWM_DTS_MEASUREMENT_NOTIF_WIDE notification will be generated by
  version 17 firmware.

Taken-From: Linux iwlwifi

6 years agoMFC r313417:
eadler [Thu, 1 Mar 2018 05:54:39 +0000 (05:54 +0000)]
MFC r313417:

[iwm] Very basic DTS thermal sensor support (prints temp as debug msg).

* Adds IWM_DEBUG_TEMP debug message type, for printing messages related
  to temperature sensors and thermal/TDP infos.

* The firmware regularly sends us DTS measurement notifications, so just
  print the temperature value as a debugging message.

(Adrian's addition):

* Eventually this can be used by the driver to limit transmit rate / power to
  try and do some thermal throttling.

6 years agoMFC r313416:
eadler [Thu, 1 Mar 2018 05:53:55 +0000 (05:53 +0000)]
MFC r313416:

[iwm] Only for family 7000 power-down busmaster DMA clocks when stopping.

6 years agoMFC r313415:
eadler [Thu, 1 Mar 2018 05:53:12 +0000 (05:53 +0000)]
MFC r313415:

[iwm] Implement apmg_wake_up_wa workaround properly for 7000 family.

* Add iwm_pcie_set_cmd_in_flight() and iwm_pcie_clear_cmd_in_flight()
  helper methods.

* Use ring->queued tracking in the command queue to set/clear the
  cmd_hold_nic_awake bit at the right points.

6 years agoMFC r313414:
eadler [Thu, 1 Mar 2018 05:52:27 +0000 (05:52 +0000)]
MFC r313414:

[iwm] Use iwm_mvm_scan_stop_wait to properly abort scans.

* Add IWM_FLAG_SCAN_RUNNING to sc->sc_flags to track whether the firmware
  is currently running a scan, in order to decide wheter iwm_scan_end
  needs to abort a running scan.

* In iwm_scan_end, if the scan is still running, we now abort it, in order
  to keep the firmware scanning state in sync.

* Try to make things a bit simpler, by reacting on the
  IWM_SCAN_OFFLOAD_COMPLETE and IWM_SCAN_COMPLETE_UMAC notifications,
  instead of IWM_SCAN_ITERATION_COMPLETE and
  IWM_SCAN_ITERATION_COMPLETE_UMAC. This should be fine since we always
  only tell the firmware to do a single scan iteration anyway.

6 years agoMFC r313413:
eadler [Thu, 1 Mar 2018 05:51:35 +0000 (05:51 +0000)]
MFC r313413:

[iwm] Add scan abort functions, to properly cancel a running scan.

* Uses the notification wait api to wait for the corresponding scan
  complete notification after sending the abort command.

6 years agoMFC r313412:
eadler [Thu, 1 Mar 2018 05:50:48 +0000 (05:50 +0000)]
MFC r313412:

[iwm] Get rid of iwm_disable_rx_dma, just use iwm_pcie_rx_stop directly.

* This also fixes one of many small nic lock handling bugs, and matches
  iwlwifi's code.

6 years agoMFC r313325:
eadler [Thu, 1 Mar 2018 05:49:32 +0000 (05:49 +0000)]
MFC r313325:

[iwm] Use notification wait API to wait for calibration to complete.

Tested:

* 7260, STA mode (2g, 5g)

6 years agoMFC r313322,r313354:
eadler [Thu, 1 Mar 2018 05:48:20 +0000 (05:48 +0000)]
MFC r313322,r313354:

[iwm] Add implementation of the notification wait api from iwlwifi.

6 years agoMFC r313317:
eadler [Thu, 1 Mar 2018 05:46:11 +0000 (05:46 +0000)]
MFC r313317:

[iwm] Change 2nd arg of iwm_phy_db_set_section() to struct iwm_rx_packet.

* This matches the function declaration in Linux's iwlwifi.

6 years agoMFC r313315,r313316:
eadler [Thu, 1 Mar 2018 05:45:22 +0000 (05:45 +0000)]
MFC r313315,r313316:

[iwm] Get rid of some gratuitous constant renaming wrt. Linux iwlwifi.

* IWM_UCODE_SECT_MAX -> IWM_UCODE_SECTION_MAX

* IWM_UCODE_TYPE_* -> IWM_UCODE_* (except for IWM_UCODE_TYPE_MAX which
  stays).

[iwm] Store paging_mem_size field in firmware image information struct.

6 years agoMFC r313314:
eadler [Thu, 1 Mar 2018 05:44:16 +0000 (05:44 +0000)]
MFC r313314:

[iwm] Sync valid_tx_ant and valid_rx_ant mask handling with iwlwifi.

* This fixes the phy_cfg field sent in the iwm_send_phy_cfg_cmd()
  command, which wasn't taking into account the valid_rx_ant and
  valid_tx_ant masks from nvm_data before.

Tested:

* 7260, STA mode, 2G and 5G

6 years agoMFC r313312:
eadler [Thu, 1 Mar 2018 05:43:10 +0000 (05:43 +0000)]
MFC r313312:

[iwm] Use chipset configuration structs like iwlwifi does.

* This makes it a bit easier to factor out common parts for e.g. the
  7000 chipset family.

* Add iwm7265d config, and recognize the 7265D chipset variant via the
  hardware revision.

Tested:

* 7260, STA mode (2ghz)

6 years agoMFC r313311:
eadler [Thu, 1 Mar 2018 05:42:00 +0000 (05:42 +0000)]
MFC r313311:

[iwm] Sync nvm parsing code with Linux iwlwifi.

* sc->sc_nvm becomes sc->nvm_data and is now a pointer instead of an
  inlined struct.

* Add sc->eeprom_size and sc->nvm_hw_section_num configuration values to
  struct iwm_softc.

* For now continue to avoid negative error return-values, and use pointer
  variables for some return values, as before.

* Continue to omit LAR (location aware regulatory) related code as well.

Tested:

* Intel 7260, STA mode (2GHz)

6 years agoMFC r313310:
eadler [Thu, 1 Mar 2018 05:40:00 +0000 (05:40 +0000)]
MFC r313310:

[iwm] make sure we call iwm_detach_local() only once.

6 years agoMFC r313309:
eadler [Thu, 1 Mar 2018 05:09:49 +0000 (05:09 +0000)]
MFC r313309:

[iwm] Sync if_iwm_phy_db code with Linux iwlwifi.

6 years agoMFC r313308:
eadler [Thu, 1 Mar 2018 05:09:08 +0000 (05:09 +0000)]
MFC r313308:

[iwm] The HW Revision stepping constants should be in if_iwmreg.h.

6 years agoMFC r313307:
eadler [Thu, 1 Mar 2018 05:08:27 +0000 (05:08 +0000)]
MFC r313307:

[iwm] TODO for QOS support.

6 years agoMFC r308777:
eadler [Thu, 1 Mar 2018 05:06:16 +0000 (05:06 +0000)]
MFC r308777:

[iwm] Sync iwm_nvm_read_chunk() function with Linux iwlwifi.

This fixes an error handling detail in iwm_nvm_read_chunk(), where an
error response from the firmware for an NVM read shouldn't be fatal if
the offset was non-zero.

6 years agoMFC r308577:
eadler [Thu, 1 Mar 2018 05:05:08 +0000 (05:05 +0000)]
MFC r308577:

iwm: If firmware load fails during init via iwm_preinit() we bail out
before calling ieee80211_ifattach() so the taskqueue hasn't been
initialized. Don't try to drain it, we'll panic.
Looks like this issue was introduced in r303326.

6 years agoMFC r308183:
eadler [Thu, 1 Mar 2018 05:03:18 +0000 (05:03 +0000)]
MFC r308183:

[iwm] Get rid of SYNC_RESP_STRUCT and SYNC_RESP_PTR macros.

* SYNC_RESP_STRUCT and SYNC_RESP_PTR originate from the OpenBSD version of
  iwm, and they weren't serving any real purpose in the FreeBSD port.

* We just do a single bus_dmamap_sync for syncing the complete received frame,
  instead of explicitly bus_dmamap_sync-ing subranges of the frame like in
  the OpenBSD iwm code.

6 years agoMFC r306900:
eadler [Thu, 1 Mar 2018 05:01:55 +0000 (05:01 +0000)]
MFC r306900:

iwm: add missing 'Rx errors' counter incrementation.

6 years agoMFC r306286:
eadler [Thu, 1 Mar 2018 04:59:55 +0000 (04:59 +0000)]
MFC r306286:

[iwm] fix default antenna selection a bit; fix 5GHz rate control handling.

* Don't do the antenna switching when setting up the rate table - we don't
  take into account whether it's an active antenna or not (eg shared with BT.)
  I'll look into this a bit more later.

* The default antenna is still 1, I'll look into that a bit more later.
  (So no, this doesn't fix it for Larry who needs ANT_B to be active, not
  ANT_A.)

* My changes to the rate control setup used the wrong method for finding
  a suitable rate, which led to 1M CCK frames being queued for 11a operation.
  This is .. sub-optimal.  Change the rate control lookup path to use
  the global table instead of the per-node table, which won't be setup
  until the node rate table is setup (which happens way too late in this
  game.)

Tested:

* Intel 7260, 2G and 5G operation.

6 years agoMFC r306142:
eadler [Thu, 1 Mar 2018 04:58:00 +0000 (04:58 +0000)]
MFC r306142:

[iwm] use rate control info from the node txrates; use mgmtrate for EAPOL frames

This changes the transmit rate control code to do a few things:

* use fixed rates (mcast, ucast, mgmt) where required.
* Don't use a hard-coded 11a or 11bg rate for non-data frames -
  use what net80211 says we should use.
* use mgmtrate for EAPOL frames.

6 years agoMFC r306007:
eadler [Thu, 1 Mar 2018 04:56:49 +0000 (04:56 +0000)]
MFC r306007:

[iwm] Improve reliability of iwm_release on disassociation a bit.

* We need to first call ivp->iv_newstate(), to enqueue the deauth/deassoc
  mgmt frame, then flush the tx queue, before actually calling
  iwm_release().

* cycling a wlan connection via wpa_cli frontend to wpa_supplicant, by
  issuing disconnect and reconnect commandos works quite well.
  (There is still an issue when disconnecting/reconnecting too quickly)

* Reassociating or roaming via wpa_supplicant is still broken.

6 years agoMFC r306005:
eadler [Thu, 1 Mar 2018 04:55:00 +0000 (04:55 +0000)]
MFC r306005:

[iwm] Remove dead fw_totlen from struct iwm_fw_sects; clean up struct iwm_nvm_data.

* No functional change, none of these values were ever read.

* The values removed from struct iwm_nvm_data are only used for old dvm
  devices in Linux iwlwifi, and irrelevant to iwm hence.

6 years agoMFC r306005:
eadler [Thu, 1 Mar 2018 04:53:54 +0000 (04:53 +0000)]
MFC r306005:

[iwm] Use IWM_DEFAULT_SCAN_CHANNELS define as default for sc_capa_n_scan_channels.

6 years agoMFC r306004:
eadler [Thu, 1 Mar 2018 04:52:23 +0000 (04:52 +0000)]
MFC r306004:

[iwm] Remove deprecated scan API definitions.

* This removes deprecated scan API definitions, which have been unused
  since the upgrade to version 16 firmware in change r303327.

* Part of this change matches the header-file changes in Linux git commit
  1f9403863c080478ad78247c89b018e95bdfb027.

* No functional change.

6 years agoMFC r30600
eadler [Thu, 1 Mar 2018 04:50:42 +0000 (04:50 +0000)]
MFC r30600

[iwm] Remove wrappers around iwm_dma_contig_free() calls.

No functional changes.

6 years agoMFC r306002
eadler [Thu, 1 Mar 2018 04:49:42 +0000 (04:49 +0000)]
MFC r306002

[iwm] Fix iwm_poll_bit() error value check in iwm_attach().

The iwm(4) iwm_poll_bit() function returns 1 on success, and 0 on failure,
whereas the iwl_poll_bit() in Linux iwlwifi returns < 0 on failure.

So the (ret < 0) check ended up ignoring any error returned by
iwm_poll_bit().

6 years agoMFC r306001
eadler [Thu, 1 Mar 2018 04:46:58 +0000 (04:46 +0000)]
MFC r306001

[iwm] Fix off-by-one check in iwm_read_firmware().

This fixes a potential buffer overrun in the firmware parsing code.

6 years agoMFC r306000
eadler [Thu, 1 Mar 2018 04:43:52 +0000 (04:43 +0000)]
MFC r306000

[iwm] Remove unused field from iwm_rx_data. Use uint32_t instead of enum type.

The wantresp field in struct iwm_rx_data has never been used for anything,
so we can just delete it.

Apparently struct iwm_sf_cfg_cmd was compiled correctly (using a 32bit
value to represent the enum), but it still seems like a very bad idea to use
an enum type in a __packed struct.

6 years agoMFC r305999:
eadler [Thu, 1 Mar 2018 04:28:54 +0000 (04:28 +0000)]
MFC r305999:

[iwm] Use htole16 for policy field in struct iwm_time_event_cmd_v2.

The htole32 was working fine for little-endian machines, but would
have been broken on big-endian.