Bug 267575 - rtwn(4): Network goes down on git clones over ssh
Summary: rtwn(4): Network goes down on git clones over ssh
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-wireless (Nobody)
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2022-11-05 16:43 UTC by Roman Bogorodskiy
Modified: 2022-11-07 18:36 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Bogorodskiy freebsd_committer freebsd_triage 2022-11-05 16:43:10 UTC
My setup:

USB wifi adapter:

From usbconfig:
ugen0.2: <Realtek 802.11ac WLAN Adapter> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

From dmesg:
rtwn0: <802.11ac WLAN Adapter > on usbus0
rtwn0: MAC/BB RTL8821AU, RF 6052 1T1R

In rc.conf I have:

wlans_rtwn0="wlan0"
ifconfig_wlan0="WPA DHCP"


/etc/wpa_supplicant.conf:

ctrl_interface=/var/run/wpa_supplicant
eapol_version=2
ap_scan=1
fast_reauth=1

network={
  ssid="ssid"
  psk="pass"
}

FreeBSD tulp 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n258661-713efe054297: Tue Oct 18 20:30:57 CEST 2022     root@tulp:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

ifconfig wlan0:
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=200001<RXCSUM,RXCSUM_IPV6>
        ether 34:98:b5:93:b1:3e
        inet 192.168.178.111 netmask 0xffffff00 broadcast 192.168.178.255
        groups: wlan
        ssid "ssid" channel 44 (5220 MHz 11a ht/20) bssid ac:f8:cc:ea:83:3a
        regdomain FCC country US authmode WPA2/802.11i privacy ON
        deftxkey UNDEF AES-CCM 2:128-bit txpower 17 bmiss 7 mcastrate 6
        mgmtrate 6 scanvalid 60 ht20 ampdulimit 64k ampdudensity 4 shortgi
        -stbc ldpctx -ldpcrx -uapsd wme roaming MANUAL
        parent interface: rtwn0
        media: IEEE 802.11 Wireless Ethernet MCS mode 11na
        status: associated
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>


Steps to reproduce:

1. In terminal, run 8.8.8.8 to easily check connectivity
2. In the other terminal, run "git clone git@github.com:freebsd/freebsd-src.git"
3. Almost immediately after that network goes down

64 bytes from 8.8.8.8: icmp_seq=211 ttl=117 time=15.179 ms
ping: sendto: Network is down                             
ping: sendto: Network is down                             
ping: sendto: Network is down                              
ping: sendto: Network is down                             
ping: sendto: Network is down                              
ping: sendto: Network is down

In /var/log/messages:
Nov  5 10:51:54 tulp wpa_supplicant[3443]: wlan0: CTRL-EVENT-DISCONNECTED bssid=06:a0:30:d9:c7:f3 reason=3 locally_generated=1
Nov  5 10:51:54 tulp kernel: rtwn0: device timeout
Nov  5 10:51:54 tulp kernel: wlan0: link state changed to DOWN
Nov  5 10:51:54 tulp kernel: rtwn0: ieee80211_crypto_encap returns NULL.

4. When I terminate git clone, the network might go up again, or I might need to do service netif restart to get it back

I have other devices connected to this network and didn't experience issues like that, though I didn't specifically run git clone on them.
I've tried changing MTU to 1400 just for testing, and it didn't have any effect.

Another observation:
This doesn't happen when cloning via https, i.e. "git clone https://gitlab.com/FreeBSD/freebsd-src.git"
Comment 1 Roman Bogorodskiy freebsd_committer freebsd_triage 2022-11-05 17:08:32 UTC
Minor correction: I used github mirror for ssh clone example and gitlab for https clone, which is inconsistent. The behavior doesn't change if I use gitlab for both cases.
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2022-11-06 21:54:38 UTC
@Roman Any additional device/driver specific debugging we can enable that might shed light on the preceding events just prior to the network drop?
Comment 3 Roman Bogorodskiy freebsd_committer freebsd_triage 2022-11-07 18:36:12 UTC
(In reply to Kubilay Kocak from comment #2)

I've checked man rtwn(4) and don't see any knobs to enable additional debugging.
Though I see there's a number of sysctls that I guess could be useful to share:

dev.rtwn.0.radar_detection: 0
dev.rtwn.0.rx_buf_size: 24
dev.rtwn.0.ratectl_selected: 1
dev.rtwn.0.ratectl: 1
dev.rtwn.0.hwcrypto: 1
dev.rtwn.0.debug: 0
dev.rtwn.0.ht40: 0
dev.rtwn.0.%parent: uhub0
dev.rtwn.0.%pnpinfo: vendor=0x0846 product=0x9052 devclass=0x00 devsubclass=0x00 devproto=0x00 sernum="00e04c000001" release=0x0200 mode=host intclass=0xff intsubclass=0xff intprotocol=0xff
dev.rtwn.0.%location: bus=0 hubaddr=1 port=6 devaddr=2 interface=0 ugen=ugen0.2
dev.rtwn.0.%driver: rtwn
dev.rtwn.0.%desc: 802.11ac WLAN Adapter 
dev.rtwn.%parent:

Some of them are tunable, but not sure if it makes sense trying to change any of them.

Some more observations:

 - Connection goes down even with git clone over https, but it happens few minutes later, not right away
 - Connection speed is very low: running speedtest on this box gives 35 Mbps download and 33 Mbps upload. My mobile phone connected to the same network gives  426 Mbps downlaod and 40 Mbps upload.