]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r302519:
eadler [Sat, 3 Mar 2018 18:11:02 +0000 (18:11 +0000)]
MFC r302519:

Audit the file-descriptor number argument for openat(2).  Remove a comment
about the desirability of auditing the number, as it was in fact in the
wrong place (in the common path for open(2) and openat(2), and only the
latter accepts a file-descriptor argument).  Where other ABIs support
openat(2), it may be necessary to do additional argument auditing as it is
not performed in kern_openat(9).

MFC after: 3 days

6 years agoMFC r329905:
kib [Sat, 3 Mar 2018 11:53:44 +0000 (11:53 +0000)]
MFC r329905:
Hide all vm/vm_pageout.h content under #ifdef _KERNEL.

6 years agoMFC r325800:
eadler [Sat, 3 Mar 2018 11:18:38 +0000 (11:18 +0000)]
MFC r325800:

Add a -r option to print the running kernel version.

6 years agoMFC r307519,r307629:
eadler [Sat, 3 Mar 2018 11:17:05 +0000 (11:17 +0000)]
MFC r307519,r307629:

Increase timeout so low-end platforms have a chance to complete test
procedures.

This fixes operation in QEMU/MIPS64.

6 years agoMFC r325450:
eadler [Sat, 3 Mar 2018 11:12:09 +0000 (11:12 +0000)]
MFC r325450:

Fix cosmetic nit when printing out "override $mode" and "$owner/$group ..."

The wrong index was being checked for == ' ' in the resulting stringified
mode from strmode(3) -- it should have been the 11th value, not the 10th.

PR: 76711

6 years agoMFC r325319:
eadler [Sat, 3 Mar 2018 11:11:07 +0000 (11:11 +0000)]
MFC r325319:

Remove artificial limit for -i.

6 years agoMFC r303727:
eadler [Sat, 3 Mar 2018 11:02:34 +0000 (11:02 +0000)]
MFC r303727:

uuid_to_string(3) is allocating memory and can fail on that.
Check if any error accrued.

6 years agoMFC r323645:
eadler [Sat, 3 Mar 2018 10:50:16 +0000 (10:50 +0000)]
MFC r323645:

kern.osreldate is an integer, not a string

PR: 217501

6 years agoMFC r322657:
eadler [Sat, 3 Mar 2018 10:47:30 +0000 (10:47 +0000)]
MFC r322657:

typo

PR: 211160

6 years agoMFC r322428:
eadler [Sat, 3 Mar 2018 10:45:19 +0000 (10:45 +0000)]
MFC r322428:

Set usage() to show -d flag
mkesdb supports the -d flag for enabling debug mode, as documented in the manual.

PR: 209865
Submitted by: Maya Rashish <coypu AT sdf DOT org>
Reviewed by: imp
Approved by: bcr (mentor)
Obtained from: NetBSD
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D11987

6 years agoMFC r322210,r322613,r322831:
eadler [Sat, 3 Mar 2018 10:43:41 +0000 (10:43 +0000)]
MFC r322210,r322613,r322831:

pgrep naively appends the delimiter to all PIDs including the last
e.g. "pgrep -d, getty" outputs "1399,1386,1309,1308,1307,1306,1305,1302,"
Ensure the list is correctly delimited by suppressing the emission of the
delimiter after the final PID.

The r322210 change to pgrep's PID delimiting behaviour causes pgrep's default
output to not include a trailing new line, which is a potential POLA violation
for existing consumers. Change pgrep to always emit a trailing new line on
completion of its output, regardless of the delimeter in use (which technically
is also a potential POLA violation for existing consumers that rely on the
pre-r322210 buggy behaviour, but a line has to be drawn somewhere).

Only emit the trailing new line added in r322613 when not operating in quiet
mode.

PR: 221534 (r322613)

6 years agoMFC r321426:
eadler [Sat, 3 Mar 2018 10:37:53 +0000 (10:37 +0000)]
MFC r321426:

cleanobj: Unhide removal of directory.

6 years agoMFC r320406:
eadler [Sat, 3 Mar 2018 10:35:00 +0000 (10:35 +0000)]
MFC r320406:

A little tweak for performance

6 years agoMFC r319843:
eadler [Sat, 3 Mar 2018 10:32:00 +0000 (10:32 +0000)]
MFC r319843:

Fix 'restart' action: rc.subr only expects to restart one service, not two.

PR: 217393

6 years agoMFC 319851:
eadler [Sat, 3 Mar 2018 10:30:54 +0000 (10:30 +0000)]
MFC 319851:

Remove the outdated definition.

6 years agoMFC r319602:
eadler [Sat, 3 Mar 2018 10:29:29 +0000 (10:29 +0000)]
MFC r319602:

Clarify -q is only for pgrep.

6 years agoMFC r318891:
eadler [Sat, 3 Mar 2018 10:27:33 +0000 (10:27 +0000)]
MFC r318891:

Fix long standing issue in bsdconfig's keymap selection

Since the translation to vt as terminal emulator, the keymaps files
path has changed and this change does not get followed in bsdconfig.
This implicates boot time warnings about a wrong keymap file, what
is very confusing for the new users and for me too, so initialize
the default keymaps search path depending on terminal type.

6 years agoMFC r314409:
eadler [Sat, 3 Mar 2018 10:18:32 +0000 (10:18 +0000)]
MFC r314409:

dc(1): Introduce e command, equivalent to p, but writes to stderr

Obtained from: OpenBSD
MFC after: 2 weeks

6 years agoMFC r313276:
eadler [Sat, 3 Mar 2018 10:15:37 +0000 (10:15 +0000)]
MFC r313276:

Use kldload -n when loading if_deqna

This fixes if_deqna from being loaded by accident twice if it's already loaded
in the kernel.

6 years agoMFC r325095:
eadler [Sat, 3 Mar 2018 10:01:12 +0000 (10:01 +0000)]
MFC r325095:

Update URLs in usr.bin

- http -> https
- contents have moved locations
- removal of URL if I could not find new location

6 years agoMFC r322424:
eadler [Sat, 3 Mar 2018 09:59:04 +0000 (09:59 +0000)]
MFC r322424:

Correct the -H longopt equivillant

PR: 209876

6 years agoDocument SA-17:12 and correct EN-17:09 link [1]
delphij [Sat, 3 Mar 2018 08:45:56 +0000 (08:45 +0000)]
Document SA-17:12 and correct EN-17:09 link [1]

Reported by: eadler [1]

6 years agostand: Make pc98 build
kevans [Sat, 3 Mar 2018 06:37:53 +0000 (06:37 +0000)]
stand: Make pc98 build

This is a direct commit to stable/11 due to pc98 removal from head.

Several improvements in head that were MFC'd left the pc98 build broken in
stable/11. Massage the pc98 bits to get it to at least build.

6 years agoMFC r321105:
np [Sat, 3 Mar 2018 03:12:19 +0000 (03:12 +0000)]
MFC r321105:

cxgbetool(8): Add loadboot and loadboot-cfg subcommands to install or
remove bootrom and boot config.

6 years agoMFC r328315:
np [Sat, 3 Mar 2018 02:39:54 +0000 (02:39 +0000)]
MFC r328315:

cxgb(4): Validate offset/len in the GET_EEPROM ioctl.

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)