Re: New laptop: AC 9461/9560: iwm or iwlwifi?

From: Marco <freebsd-wireless_at_lordsith.net>
Date: Fri, 30 Dec 2022 10:38:13 UTC
On Wed, Dec 28, 2022 at 09:51:31PM +0000, you (Bjoern A. Zeeb) sent the following to [freebsd-wireless] :
> > Dec 19 22:31:42 harbinger wpa_supplicant[73966]: wlan0: CTRL-EVENT-DISCONNECTED bssid=72:a7:41:9b:4f:da reason=3 locally_generated=1
> > Dec 19 22:31:42 harbinger wpa_supplicant[73966]: wlan0: CTRL-EVENT-DSCP-POLICY clear_all
> > Dec 19 22:31:42 harbinger syslogd: last message repeated 1 times
> > Dec 19 22:31:42 harbinger wpa_supplicant[73966]: wlan0: CTRL-EVENT-TERMINATING
> > Dec 19 22:31:42 harbinger kernel: [680] wlan0: link state changed to DOWN
> > Dec 19 22:31:42 harbinger rtsold[63523]: <rtsock_input_ifannounce> interface wlan0 removed
> > Dec 19 22:31:42 harbinger kernel: [680] iwm0: detached
> > Dec 19 22:31:42 harbinger kernel: [680] pci0:0:20:3: Transition from D0 to D3
> > Dec 19 22:31:42 harbinger root[97472]: /etc/rc.d/netif: WARNING: wlan0 does not exist.  Skipped.
> > Dec 19 22:31:42 harbinger kernel: [681] pci0:0:20:3: Transition from D0 to D3
> > Dec 19 22:31:42 harbinger kernel: [681] iwlwifi0: <iwlwifi> mem 0xea238000-0xea23bfff irq 16 at device 20.3 on pci0
> > Dec 19 22:31:42 harbinger kernel: [681] iwlwifi0: HW_REV=0xFFFFFFFF, PCI issues?
> > Dec 19 22:31:42 harbinger kernel: [681] device_attach: iwlwifi0 attach returned 5
> >
> > Despite pci0:0:20:3 seeemingly "attached" to iwlwifi0 I can't seem to
> > get wlan0 created using iwlwifi as parent.
> 
> So you by any chance have any power saving sysctl (or tunables) set?

Yes I have always had the powersave argument in the create_args_wlan0 in
rc.conf.

As before I'm still on stable/13-n253250-308d3d6be6da so no new bits
have been introduced:

[~] uname -aKU
FreeBSD harbinger.fritz.box 13.1-STABLE FreeBSD 13.1-STABLE #1 stable/13-n253250-308d3d6be6da: Fri Dec  9 15:31:21 UTC 2022     root@harbinger.fritz.box:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 1301510 1301510

If it helps I can list my full contents for rc.conf, loader.conf and
sysctl.conf?

This is my current /etc/rc.conf regarding networking: 

# Network settings
hostname="harbinger.fritz.box"
ip6addrctl_policy="ipv6_prefer"
ipv6_privacy="YES"      #NO : Use privacy address on RA-receiving IFs (RFC 4941)
#devmatch_blocklist="if_iwm"
#create_args_wlan0="wlanmode sta regdomain ETSI country NL powersave"
#devmatch_blocklist="if_iwlwifi"
wlans_iwm0="wlan0"
wlans_iwlwifi0="wlan0"
create_args_wlan0="regdomain ETSI country NL authmode WPA powersave"
ifconfig_wlan0="ether f8:75:a4:fa:9d:bf WPA"
ifconfig_em0="up"
create_args_em0="polling"
cloned_interfaces="lagg0"
ifconfig_lagg0="up laggproto failover laggport em0 laggport wlan0 -tso -lro DHCP"
ifconfig_lagg0_ipv6="inet6 accept_rtadv"
rtsold_enable="YES"
rtsold_flags="-aF"
sshd_enable="YES"
pf_enable="YES"
pflog_enable="YES"
# End Network settings

What kind of power saving sysctl should I be looking for?

I have power related settings in sysctl.conf:

# Power Settings
dev.cpu.0.cx_lowest=C1
dev.cpu.1.cx_lowest=C3
dev.cpu.2.cx_lowest=C3
dev.cpu.3.cx_lowest=C3

And loader.conf contains:

# Power settings
machdep.hwpstate_pkg_ctrl=0             #1 : Set 1 (default) to enable package-level control, 0 to disable
cpuctl_load="YES"
cpu_microcode_load="YES"
cpu_microcode_name="/boot/firmware/intel-ucode.bin"
hw.pci.do_power_nodriver=3
hw.em.smart_pwr_down=1 # (0) smart power down on newer em(4) adapters
#hint.p4tcc.0.disabled=1 # see device.hints(5)
#hint.acpi_throttle.0.disabled=1 # see device.hints(5)
hint.hwpstate_intel.0.disabled=0        #0 : workaround to prevent system freeze due to buggy smm implementation (see https://reviews.freebsd.org/D36699)
compat.linuxkpi.enable_rc6="7"  # enable power saving render C-State 6
compat.linuxkpi.i915_enable_dc="2"      # enable power saving display C-States
compat.linuxkpi.i915_enable_fbc="1"  # enable frame buffer compression for power savings
compat.linuxkpi.i915_fastboot="1"       # skip unnecessary mode sets at boot time
compat.linuxkpi.i915_nuclear_pageflip="1"
#compat.linuxkpi.semaphores="1"         # use semaphores for inter ring sync # nolonger found on 13.1-STABLE stable/13-n250696-3c01fdcfc161
# End Power settings


> 
> I see two transiotions from D0 to D3 logged but nothing taking the
> device out of D3 gets logged (could be an omission elsewhere).
> 
> Can you show a
>  	pciconf -lBbcevV iwlwifi0
> or
>  	pciconf -lBbcevV pci0:0:20:3
> (which ever one works in that state)?
> 

In a working state with iwm0 as parent:

[~] doas pciconf -lBbcevV iwm0
iwm0@pci0:0:20:3:	class=0x028000 rev=0x11 hdr=0x00 vendor=0x8086 device=0x9df0 subvendor=0x8086 subdevice=0x0030
    vendor     = 'Intel Corporation'
    device     = 'Cannon Point-LP CNVi [Wireless-AC]'
    class      = network
    bar   [10] = type Memory, range 64, base 0xea238000, size 16384, enabled
    cap 01[c8] = powerspec 3  supports D0 D3  current D0
    cap 05[d0] = MSI supports 1 message, 64 bit enabled with 1 message
    cap 10[40] = PCI-Express 2 root endpoint max data 128(128) FLR RO NS
                 max read 128
    cap 11[80] = MSI-X supports 16 messages
                 Table in map 0x10[0x2000], PBA in map 0x10[0x3000]
    ecap 0000[100] = unknown 0
    ecap 0018[14c] = LTR 1
    ecap 000b[164] = Vendor [1] ID 0010 Rev 0 Length 20


After having detached, performed the reset and trying to set driver for
pci0:0:20:3 to iwlwifi0 (which returns that I/O error) using devctl the output of
pciconf -lBbcevV is identical as above just showing iwlwifi0 instead of
iwm0:

[~] doas pciconf -lBbcevV pci0:0:20:3
iwlwifi0@pci0:0:20:3:   class=0x028000 rev=0x11 hdr=0x00 vendor=0x8086 device=0x9df0 subvendor=0x8086 subdevice=0x0030
    vendor     = 'Intel Corporation'
    device     = 'Cannon Point-LP CNVi [Wireless-AC]'
    class      = network
    bar   [10] = type Memory, range 64, base 0xea238000, size 16384, disabled
    cap 01[c8] = powerspec 3  supports D0 D3  current D3
    cap 05[d0] = MSI supports 1 message, 64 bit
    cap 10[40] = PCI-Express 2 root endpoint max data 128(128) FLR RO NS
                 max read 128
    cap 11[80] = MSI-X supports 16 messages
                 Table in map 0x10[0x2000], PBA in map 0x10[0x3000]
    ecap 0000[100] = unknown 0
    ecap 0018[14c] = LTR 1
    ecap 000b[164] = Vendor [1] ID 0010 Rev 0 Length 20


-- 
Marco van Lienen -- FreeBSD enthusiast
https://keybase.io/scarcry , GnuPG fingerprint: A025 D8AA AC1B D2FC 380D 4FC1 8EA0 0BA8 8580 E6CB
"The Tuck Pendleton machine...zero defects."