Re: qwx0: failed to send/start with QCNFA765

2024-02-23 Thread Stefan Sperling
On Fri, Feb 23, 2024 at 11:58:51AM +0100, Marco van Hulten wrote:
> Today, after installing the latest snapshot, I do not get this error
> anymore.  Does it contain the patch?

Yes, it should.
The latest snap's build date is newer than my commit from last night.

> Wi-Fi to normal access points is working fine.  Still a problem with
> eduroam, but I think that should be unrelated to qwx(4).

Perhaps, I wouldn't know. I don't have any way to test WPA Enterprise.



Re: qwx0: failed to send/start with QCNFA765

2024-02-23 Thread Marco van Hulten
On Thu, 22 Feb 2024 17:17:45 +0100 Stefan Sperling wrote:
> On Thu, Feb 22, 2024 at 03:28:42PM +0100, Marco van Hulten wrote:
> > On Thu, 22 Feb 2024 13:29:27 +0100 Stefan Sperling wrote:  
> > > Can you reproduce this on non-WPA-Enterprise networks,
> > > i.e. without eduraom / wpaakms 802.1x?  
> > 
> > Did not succeed in reproducing so far.  
> 
> I figured out the scan command error, details and patch below.
> 
> The good news is that this is just a cosmetic issue.
> Let me know if you still see any issues with the patch applied.

>   qwx0: failed to send WMI_START_SCAN_CMDID
>   qwx0: failed to start hw scan: 58

Today, after installing the latest snapshot, I do not get this error
anymore.  Does it contain the patch?

Wi-Fi to normal access points is working fine.  Still a problem with
eduroam, but I think that should be unrelated to qwx(4).

Marco



Re: qwx0: failed to send/start with QCNFA765

2024-02-22 Thread Stefan Sperling
On Thu, Feb 22, 2024 at 03:28:42PM +0100, Marco van Hulten wrote:
> On Thu, 22 Feb 2024 13:29:27 +0100 Stefan Sperling wrote:
> > Can you reproduce this on non-WPA-Enterprise networks,
> > i.e. without eduraom / wpaakms 802.1x?
> 
> Did not succeed in reproducing so far.

I figured out the scan command error, details and patch below.

The good news is that this is just a cosmetic issue.
Let me know if you still see any issues with the patch applied.

> Additional dmesg output that seems to be new:
> 
> qwx0: missed beacon threshold set to 30 beacons, beacon interval is 100 TU
> qwx0: failed to enqueue rx buf: 28
> qwx_ce_recv_process_cb: failed to post rx buf to pipe: 2 err: 28

The above is a known issue I still need to investigate.
I suspect it is harmless.

Now, regarding your scan command failures:

An important detail is that ifconfig will make multiple calls into
the kernel while reconfiguring the interface:

ifconfig qwx0 nwid eduroam wpa wpaakms 802.1x up

This command enters the driver in the kernel 4 times in a row:

nwid eduroam# 1) set network ID
wpa # 2) enable WPA
wpaakms 802.1x  # 3) enable WPA Enterprise
up  # 4) set UP flag

Every time the driver is entered, a configuration change is flagged
(by signalling error ENETRESET internally) which causes the driver
to stop and restart the interface to let the configuration change take
effect. Provided the interface is already marked UP, the final step
of restarting a wifi device is to begin a scan for APs.

This scan runs in a separate background thread in the kernel and the
ifconfig process will continue running "in parallel" to the scan.
ifonfig will more or less immediately enter the kernel again to
apply the next configuration item (e.g. in step 2 to enable WPA).

Now the driver wants to stop the interface again, but the scan thread
is still active!
We don't want the device to see a confusing mix of commands coming from
multiple threads, so the driver needs to wait for the scan thread to
finish before it can proceed to stop and restart the device again.
The ifconfig driver thread sets a global "please stop" flag and waits...

Before the scan thread sends its scan command it will check the "please stop"
flag. When it is set, the Linux code we inherited returns ESHUTDOWN, which
is error number 58. This matches the error you are seeing:

  qwx0: failed to start hw scan: 58

So this is not an actual error condition, it is expected behaviour.
ESHUTDOWN will cause the scan thread to stop what is it doing and
allow the ifconfig driver thread to take back control of the hardware.

The patch below should avoid printing a warning about this for all
WMI commands, including your case, but handling other potential
cases as well.

---
 make qwx(4) ignore ESHUTDOWN while printing errors to dmesg
 
 ESHUTDOWN is an expected thread-synchronization condition which
 can be triggered via ifconfig commands. Don't warn about this.
 
 Reported by Marco van Hulten on misc@
 
diff 11a0e80d7bc8830d3a9189682bad3c13b0eeb2cb 
9d7e156a181573d2b75a72c9297a5ec5796865f7
commit - 11a0e80d7bc8830d3a9189682bad3c13b0eeb2cb
commit + 9d7e156a181573d2b75a72c9297a5ec5796865f7
blob - 43753d3d31405116391a7f706fb0735162b062b5
blob + f0ad77d417bb8774b7de90c543705bd9bbec57a9
--- sys/dev/ic/qwx.c
+++ sys/dev/ic/qwx.c
@@ -17232,8 +17232,10 @@ qwx_wmi_pdev_set_param(struct qwx_softc *sc, uint32_t 
 
ret = qwx_wmi_cmd_send(wmi, m, WMI_PDEV_SET_PARAM_CMDID);
if (ret) {
-   printf("%s: failed to send WMI_PDEV_SET_PARAM cmd\n",
-   sc->sc_dev.dv_xname);
+   if (ret != ESHUTDOWN) {
+   printf("%s: failed to send WMI_PDEV_SET_PARAM cmd\n",
+   sc->sc_dev.dv_xname);
+   }
m_freem(m);
return ret;
}
@@ -17268,8 +17270,10 @@ qwx_wmi_pdev_lro_cfg(struct qwx_softc *sc, uint8_t pde
 
ret = qwx_wmi_cmd_send(wmi, m, WMI_LRO_CONFIG_CMDID);
if (ret) {
-   printf("%s: failed to send lro cfg req wmi cmd\n",
-   sc->sc_dev.dv_xname);
+   if (ret != ESHUTDOWN) {
+   printf("%s: failed to send lro cfg req wmi cmd\n",
+   sc->sc_dev.dv_xname);
+   }
m_freem(m);
return ret;
}
@@ -17303,8 +17307,10 @@ qwx_wmi_pdev_set_ps_mode(struct qwx_softc *sc, int vde
 
ret = qwx_wmi_cmd_send(wmi, m, WMI_STA_POWERSAVE_MODE_CMDID);
if (ret) {
-   printf("%s: failed to send WMI_PDEV_SET_PARAM cmd\n",
-   sc->sc_dev.dv_xname);
+   if (ret != ESHUTDOWN) {
+   printf("%s: failed to send WMI_PDEV_SET_PARAM cmd\n",
+   sc->sc_dev.dv_xname);
+   }
m_freem(m);
return ret;
}
@@ 

Re: qwx0: failed to send/start with QCNFA765

2024-02-22 Thread Marco van Hulten
On Thu, 22 Feb 2024 13:29:27 +0100 Stefan Sperling wrote:
> On Thu, Feb 22, 2024 at 11:35:35AM +0100, Marco van Hulten wrote:
> > Hello,
> > 
> > The Qualcomm QCNFA765 (support recently added) in my ThinkPad P14s
> > worked for some time, but now it mostly does not and I get these kernel
> > messages:
> > 
> >   qwx0: failed to send WMI_START_SCAN_CMDID
> >   qwx0: failed to start hw scan: 58
> > 
> > This happens when I run this command:
> > 
> >   ifconfig qwx0 nwid eduroam wpa wpaakms 802.1x up
> > 
> > dmesg is attached.  Is this a bug or am I doing something wrong?
> > 
> > Similar, when I first scan and then try to join an open network,
> > following qwx(4),
> > 
> >   qwx0: failed to send WMI_11D_SCAN_START_CMDID: 58
> >   qwx0: failed to start 11d scan; vdev: 0 ret: 58
> >   qwx0: failed to send WMI_START_SCAN_CMDID
> >   qwx0: failed to start hw scan: 58
> > 
> > Sometimes it works again; I cannot put my finger what triggers the
> > problem.  
> 
> Please show a full trace that appears after you run 'ifconfig qwx0 debug'.

Just 'ifconfig qwx0 debug' doesn't give any output (terminal or
console).  I don't know if it should.  The commands 'ifconfig qwx0 down;
ifconfig qwx0 up debug' resulted on console:

qwx0: ASSOC -> RUN
qwx0: INIT -> SCAN
qwx0: end active scan
qwx0: - 1c:9e:cc:3b:d3:b0   11  +171 54M   ess  privacy   rsn! "Vodafone-D3AC"!
qwx0: - 1c:9e:cc:3b:d3:b8  100  +169 54M   ess  privacy   rsn! "Vodafone-D3AC"!
qwx0: - 1c:ed:6f:bb:ea:bf  100  +172 54M   ess  privacy   rsn! "fHome"!
qwx0: - 1c:ed:6f:bb:ea:c1   60  +168 54M   ess  privacy   rsn! "fHome"!
qwx0: - 26:7b:cb:c6:10:0a   48  +208 54M   ess  privacy   rsn! 
"DIRECT-WTBDGP14SmsWV"!
qwx0: - 6e:63:9c:51:08:fd6  +173 54M   ess   no!  rsn! "Vodafone 
Hotspot"!
qwx0: - 74:88:bb:4f:74:8d   48  +206 54M   ess   no!  rsn! "gast-bonnet"!
qwx0: - 74:88:bb:4f:74:8e   48  +206 54M   ess   no!  rsn! "bonnet"!
qwx0: + 74:88:bb:4f:74:8f   48  +206 54M   ess  privacy   rsn  "eduroam"
qwx0: + 74:88:bb:9c:32:605  +188 54M   ess  privacy   rsn  "eduroam"
qwx0: - 74:88:bb:9c:32:6d  140  +178 54M   ess   no!  rsn! "gast-bonnet"!
qwx0: - 74:88:bb:9c:32:6e  140  +178 54M   ess   no!  rsn! "bonnet"!
qwx0: + 74:88:bb:9c:32:6f  140  +178 54M   ess  privacy   rsn  "eduroam"
qwx0: + 74:88:bb:d0:63:c05  +183 54M   ess  privacy   rsn  "eduroam"
qwx0: - 74:88:bb:d0:63:c15  +183 54M   ess   no!  rsn! "bonnet"!
qwx0: - 74:88:bb:d0:63:c25  +183 54M   ess   no!  rsn! "gast-bonnet"!
qwx0: - 74:88:bb:d0:63:cd   36  +184 54M   ess   no!  rsn! "gast-bonnet"!
qwx0: - 74:88:bb:d0:63:ce   36  +184 54M   ess   no!  rsn! "bonnet"!
qwx0: + 74:88:bb:d0:63:cf   36  +184 54M   ess  privacy   rsn  "eduroam"
qwx0: - ce:9e:a2:2b:a0:be   11  +171 54M   ess  privacy   rsn! 
0x00!
qwx0: SCAN -> AUTH
qwx0: sending auth to 74:88:bb:4f:74:8f on channel 48 mode 11a
qwx0: AUTH -> ASSOC
qwx0: sending assoc_req to 74:88:bb:4f:74:8f on channel 48 mode 11a
qwx0: ASSOC -> RUN
qwx0: associated with 74:88:bb:4f:74:8f ssid "eduroam" channel 48 start 9Mb 
short preamble short slot time
qwx0: missed beacon threshold set to 30 beacons, beacon interval is 100 TU

> Can you reproduce this on non-WPA-Enterprise networks,
> i.e. without eduraom / wpaakms 802.1x?

Did not succeed in reproducing so far.  I tried a network without a
mention of "802.1x", namely from

detekti# ifconfig qwx0 scan 
qwx0: flags=808847 mtu 
1500
lladdr 04:7b:cb:b6:bf:14
index 2 priority 4 llprio 3
groups: wlan egress
media: IEEE802.11 autoselect mode 11a (OFDM9 mode 11a)
status: no network
ieee80211: nwid eduroam chan 48 bssid 74:88:bb:4f:74:8f -52dBm 
wpaprotos wpa2 wpaakms 802.1x wpaciphers ccmp wpagroupcipher ccmp
nwid DIRECT-WTBDGP14SmsWV chan 36 bssid 26:7b:cb:c6:10:0a 
-47dBm HT-MCS15 privacy,spectrum_mgmt,wpa2 !wpaproto
nwid gast-bonnet chan 1 bssid 74:88:bb:4f:74:82 -50dBm HT-MCS23 
spectrum_mgmt,radio_measurement 
nwid eduroam chan 1 bssid 74:88:bb:4f:74:80 -50dBm HT-MCS23 
privacy,spectrum_mgmt,radio_measurement,wpa2,802.1x
[...]

I selected 'gast-bonnet':

detekti# ifconfig qwx0 join gast-bonnet debug
detekti# ifconfig qwx0   
qwx0: flags=808806 mtu 1500
lladdr 04:7b:cb:b6:bf:14
index 2 priority 4 llprio 3
groups: wlan egress
media: IEEE802.11 autoselect mode 11a (OFDM9 mode 11a)
status: no network
ieee80211: nwid eduroam wpaprotos wpa2 wpaakms 802.1x wpaciphers ccmp 
wpagroupcipher ccmp

Nothing on console from these commands.  I cannot reproduce the error.

Additional dmesg output that seems to be new:

qwx0: missed beacon threshold set to 30 beacons, beacon interval is 100 TU
qwx0: failed to enqueue rx buf: 28
qwx_ce_recv_process_cb: failed to post rx buf to pipe: 2 err: 28

I will try my networks at home tonight and try to reproduce the error
and generate debug 

Re: qwx0: failed to send/start with QCNFA765

2024-02-22 Thread Stefan Sperling
On Thu, Feb 22, 2024 at 11:35:35AM +0100, Marco van Hulten wrote:
> Hello,
> 
> The Qualcomm QCNFA765 (support recently added) in my ThinkPad P14s
> worked for some time, but now it mostly does not and I get these kernel
> messages:
> 
>   qwx0: failed to send WMI_START_SCAN_CMDID
>   qwx0: failed to start hw scan: 58
> 
> This happens when I run this command:
> 
>   ifconfig qwx0 nwid eduroam wpa wpaakms 802.1x up
> 
> dmesg is attached.  Is this a bug or am I doing something wrong?
> 
> Similar, when I first scan and then try to join an open network,
> following qwx(4),
> 
>   qwx0: failed to send WMI_11D_SCAN_START_CMDID: 58
>   qwx0: failed to start 11d scan; vdev: 0 ret: 58
>   qwx0: failed to send WMI_START_SCAN_CMDID
>   qwx0: failed to start hw scan: 58
> 
> Sometimes it works again; I cannot put my finger what triggers the
> problem.

Please show a full trace that appears after you run 'ifconfig qwx0 debug'.

Can you reproduce this on non-WPA-Enterprise networks,
i.e. without eduraom / wpaakms 802.1x?



qwx0: failed to send/start with QCNFA765

2024-02-22 Thread Marco van Hulten
Hello,

The Qualcomm QCNFA765 (support recently added) in my ThinkPad P14s
worked for some time, but now it mostly does not and I get these kernel
messages:

  qwx0: failed to send WMI_START_SCAN_CMDID
  qwx0: failed to start hw scan: 58

This happens when I run this command:

  ifconfig qwx0 nwid eduroam wpa wpaakms 802.1x up

dmesg is attached.  Is this a bug or am I doing something wrong?

Similar, when I first scan and then try to join an open network,
following qwx(4),

  qwx0: failed to send WMI_11D_SCAN_START_CMDID: 58
  qwx0: failed to start 11d scan; vdev: 0 ret: 58
  qwx0: failed to send WMI_START_SCAN_CMDID
  qwx0: failed to start hw scan: 58

Sometimes it works again; I cannot put my finger what triggers the
problem.

According to fw_update, qwx firmware is installed.

Kind regards,

Marco


dmesg.P14s
Description: Binary data