Bug 233949 - [rtwn] if_rtwn packet loss 10-25%
Summary: [rtwn] if_rtwn packet loss 10-25%
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: 12.0-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-wireless mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-12 00:20 UTC by mr_beaner_2003
Modified: 2019-01-19 16:05 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mr_beaner_2003 2018-12-12 00:20:22 UTC
RE: 218527, is not fixed. I am testing with an EDIMAX N150 Nano USB Adapter.

# freebsd-version
13.0-CURRENT

# usbconfig -d ugen1.2 dump_all_desc 
ugen1.2: <Realtek 802.11n WLAN Adapter> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0200 
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000 
  bDeviceProtocol = 0x0000 
  bMaxPacketSize0 = 0x0040 
  idVendor = 0x7392 
  idProduct = 0x7811 
  bcdDevice = 0x0200 
  iManufacturer = 0x0001  <Realtek>
  iProduct = 0x0002  <802.11n WLAN Adapter>
  iSerialNumber = 0x0003  <00e04c000001>
  bNumConfigurations = 0x0001 

 Configuration index 0

    bLength = 0x0009 
    bDescriptorType = 0x0002 
    wTotalLength = 0x002e 
    bNumInterfaces = 0x0001 
    bConfigurationValue = 0x0001 
    iConfiguration = 0x0000  <no string>
    bmAttributes = 0x00a0 
    bMaxPower = 0x00fa 

    Interface 0
      bLength = 0x0009 
      bDescriptorType = 0x0004 
      bInterfaceNumber = 0x0000 
      bAlternateSetting = 0x0000 
      bNumEndpoints = 0x0004 
      bInterfaceClass = 0x00ff  <Vendor specific>
      bInterfaceSubClass = 0x00ff 
      bInterfaceProtocol = 0x00ff 
      iInterface = 0x0000  <no string>

     Endpoint 0
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0081  <IN>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0200 
        bInterval = 0x0000 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000 

     Endpoint 1
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0002  <OUT>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0200 
        bInterval = 0x0000 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000 

     Endpoint 2
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0003  <OUT>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0200 
        bInterval = 0x0000 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000 

     Endpoint 3
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0084  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0040 
        bInterval = 0x0001 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000 

# ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 74:da:38:d5:f5:4b
	inet 172.30.8.76 netmask 0xffffffc0 broadcast 172.30.8.127 
	groups: wlan 
	ssid WAPNAME channel 11 (2462 MHz 11g ht/20) bssid 80:2a:a8:d7:ec:a5
	regdomain FCC country US authmode WPA2/802.11i privacy ON
	deftxkey UNDEF AES-CCM 2:128-bit txpower 30 bmiss 7 scanvalid 60
	protmode CTS ht20 ampdulimit 64k ampdudensity 8 shortgi -stbc -ldpc
	wme roaming MANUAL
	media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
	status: associated
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

# ping -c 100 172.30.8.65
PING 172.30.8.65 (172.30.8.65): 56 data bytes
64 bytes from 172.30.8.65: icmp_seq=0 ttl=255 time=16.389 ms
...
64 bytes from 172.30.8.65: icmp_seq=59 ttl=255 time=1316.844 ms
64 bytes from 172.30.8.65: icmp_seq=61 ttl=255 time=121.498 ms
64 bytes from 172.30.8.65: icmp_seq=62 ttl=255 time=44.221 ms
64 bytes from 172.30.8.65: icmp_seq=63 ttl=255 time=59.534 ms
64 bytes from 172.30.8.65: icmp_seq=64 ttl=255 time=66.640 ms
64 bytes from 172.30.8.65: icmp_seq=65 ttl=255 time=39.747 ms
64 bytes from 172.30.8.65: icmp_seq=66 ttl=255 time=57.837 ms
64 bytes from 172.30.8.65: icmp_seq=67 ttl=255 time=104.932 ms
...

--- 172.30.8.65 ping statistics ---
100 packets transmitted, 75 packets received, 25.0% packet loss
round-trip min/avg/max/stddev = 12.461/58.785/1316.844/147.781 ms
Comment 1 mr_beaner_2003 2018-12-12 00:24:31 UTC
# cat /boot/loader.conf 
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
zfs_load="YES"
legal.realtek.license_ack=1
if_rtwn_pci_load="YES"
if_rtwn_usb_load="YES"
pf_load="YES"

# cat /etc/rc.conf
...
ifconfig_em0="DHCP"
wlans_rtwn0="wlan0"
ifconfig_wlan0="WPA DHCP"
...
Comment 2 Andriy Voskoboinyk freebsd_committer 2018-12-12 23:38:48 UTC
Hi,

Ping times are a bit unstable - how many APs in range? (ifconfig wlan0 list scan)

You can try to disable some (or all) 11n features - there may be a reason of packet loss:
1) ifconfig wlan0 -shortgi
2) ifconfig wlan0 -ampdutx
3) ifconfig wlan0 -amsdutx

If nothing helps, try to force 11g mode:
ifconfig wlan0 channel 11:g
Comment 3 mr_beaner_2003 2018-12-13 02:58:11 UTC
I have two SSIDs from one WAP,
# ifconfig wlan0 list scan
SSID/MESH ID                      BSSID              CHAN RATE    S:N     INT CAPS
WAPGUEST                       82:2a:a8:d7:ec:a5   11   54M  -81:-95   100 EPS  BSSLOAD HTCAP WME ATH RSN
WAPNAME                      80:2a:a8:d7:ec:a5   11   54M  -83:-95   100 EPS  BSSLOAD HTCAP WME ATH RSN
# ping -c 100 -q 172.30.8.65
PING 172.30.8.65 (172.30.8.65): 56 data bytes

--- 172.30.8.65 ping statistics ---
100 packets transmitted, 98 packets received, 2.0% packet loss
round-trip min/avg/max/stddev = 8.787/20.475/77.679/12.369 ms
#  
# ifconfig wlan0 -shortgi
# ping -c 100 -q 172.30.8.65
PING 172.30.8.65 (172.30.8.65): 56 data bytes

--- 172.30.8.65 ping statistics ---
100 packets transmitted, 99 packets received, 1.0% packet loss
round-trip min/avg/max/stddev = 9.907/31.190/1020.956/101.438 ms
# ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 74:da:38:d5:f5:4b
	inet 172.30.8.76 netmask 0xffffffc0 broadcast 172.30.8.127 
	groups: wlan 
	ssid WAPNAME channel 11 (2462 MHz 11g ht/20) bssid 80:2a:a8:d7:ec:a5
	regdomain FCC country US authmode WPA2/802.11i privacy ON
	deftxkey UNDEF AES-CCM 2:128-bit txpower 30 bmiss 7 scanvalid 60
	protmode CTS ht20 ampdulimit 64k ampdudensity 8 -stbc -ldpc wme
	roaming MANUAL
	media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
	status: associated
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
# ifconfig wlan0 -ampdutx
# ping -c 100 -q 172.30.8.65
PING 172.30.8.65 (172.30.8.65): 56 data bytes

--- 172.30.8.65 ping statistics ---
100 packets transmitted, 100 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 10.537/21.692/70.821/10.093 ms
# ifconfig wlan0 ampdutx
# ifconfig wlan0 amsdutx
# ping -c 100 -q 172.30.8.65
PING 172.30.8.65 (172.30.8.65): 56 data bytes

--- 172.30.8.65 ping statistics ---
100 packets transmitted, 99 packets received, 1.0% packet loss
round-trip min/avg/max/stddev = 11.616/31.129/1034.261/101.653 ms
# ping -c 100 -q 172.30.8.65
PING 172.30.8.65 (172.30.8.65): 56 data bytes
f
--- 172.30.8.65 ping statistics ---
100 packets transmitted, 99 packets received, 1.0% packet loss
round-trip min/avg/max/stddev = 11.069/29.829/1092.987/107.861 ms
# ifconfig wlan0 -amsdutx
# ping -c 100 -q 172.30.8.65
PING 172.30.8.65 (172.30.8.65): 56 data bytes

--- 172.30.8.65 ping statistics ---
100 packets transmitted, 99 packets received, 1.0% packet loss
round-trip min/avg/max/stddev = 10.609/28.940/1082.781/106.818 ms
# ifconfig wlan0 amsdutx
# ifconfig wlan0 ampdutx
# ifconfig wlan0 
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 74:da:38:d5:f5:4b
	inet 172.30.8.76 netmask 0xffffffc0 broadcast 172.30.8.127 
	groups: wlan 
	ssid WAPNAME channel 11 (2462 MHz 11g ht/20) bssid 80:2a:a8:d7:ec:a5
	regdomain FCC country US authmode WPA2/802.11i privacy ON
	deftxkey UNDEF AES-CCM 2:128-bit txpower 30 bmiss 7 scanvalid 60
	protmode CTS ht20 ampdulimit 64k ampdudensity 8 -stbc -ldpc wme
	roaming MANUAL
	media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
	status: associated
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
# ifconfig wlan0 channel 11:g
# ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 74:da:38:d5:f5:4b
	inet 172.30.8.76 netmask 0xffffffc0 broadcast 172.30.8.127 
	groups: wlan 
	ssid WAPNAME channel 11 (2462 MHz 11g ht/20) bssid 80:2a:a8:d7:ec:a5
	regdomain FCC country US authmode WPA2/802.11i privacy ON
	deftxkey UNDEF AES-CCM 2:128-bit txpower 30 bmiss 7 scanvalid 60
	protmode CTS ht20 ampdulimit 64k ampdudensity 8 -stbc -ldpc wme
	roaming MANUAL
	media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
	status: associated
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
# ping -c 100 -q 172.30.8.65
PING 172.30.8.65 (172.30.8.65): 56 data bytes

--- 172.30.8.65 ping statistics ---
100 packets transmitted, 84 packets received, 16.0% packet loss
round-trip min/avg/max/stddev = 10.599/175.849/2100.622/391.322 ms
# 

Using the -ht flag doesn't improve performance, and I can replicate this issue across three different, identical NICs.
Comment 4 mr_beaner_2003 2018-12-27 23:11:21 UTC
I've run a PCAP on the gateway, as well as the host, and it would appear that it largely affects the receive queue and it's asymmetrical sends-receives. The packet loss is on the reception side.
Comment 5 mr_beaner_2003 2019-01-04 17:04:15 UTC
I think the tx/rx queues are jacked. I get 100% packet transfer in DragonFlyBSD and 100% in OpenBSD. I am unsure about the code re-architecture.
Comment 6 Farhan Khan 2019-01-09 06:14:33 UTC
Is there something you are doing to produce this issue? I do not have this problem on my end. I have an RTL8188EU and it works without packet loss for me.
Comment 7 mr_beaner_2003 2019-01-09 17:44:07 UTC
I am just performing an ICMP-echo to my gateway with the rtwn(4) driver. I have determined that it's neither the 80211 stack nor the NIC because I get 0% packet loss with DFlyBSD/OpenBSD and their urtwn(4) driver.

While performing the ICMP-echo with the gateway, I've captured a PCAP on the gateway and the FreeBSD host; I see FreeBSD sending the ICMP-echo, and I see the gateway receiving it and sending the ICMP-reply back. But on the FreeBSD/12-RELEASE and FreeBSD/13-CURRENT host, the ICMP-replies are not showing in the PCAP.

I am using an EDIMAX N150 (RTL8192CU) wireless NIC, as outlined in my usbconfig dump.
Comment 8 Andriy Voskoboinyk freebsd_committer 2019-01-19 16:05:22 UTC
This is RTL8192CU-specific - I can reproduce the packet loss with RTL8188CUS, but not with others.