Bug 203105 - [new driver] Port openbsd rtwn, new rtl8188ce driver
Summary: [new driver] Port openbsd rtwn, new rtl8188ce driver
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-wireless mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-14 19:28 UTC by Tony Narlock
Modified: 2016-02-21 18:52 UTC (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tony Narlock 2015-09-14 19:28:38 UTC
New in OpenBSD 5.8: 

- http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man4/rtwn.4
- http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/pci/if_rtwn.c
- http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/pci/if_rtwnreg.h

It seems there may be (seeking clarification in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203104) missing support for rtl8188ce. OpenBSD made a driver for it, I've been using it and its been stable so far.
Comment 1 Tony Narlock 2015-09-14 19:38:20 UTC
I would like to give this a stab myself on the weekend to learn the internals more and get in a contribution. It would be superb to see if this could make it in 11-CURRENT.

If you already are on this and want to give it shot / could do it easily, no problem, just mention here.

Is the fact that this module is separate from urtwn pose a problem? (OpenBSD made a whole different module for rtl8188ce called rtwn instead of having it in urtwn, I suppose they have a good reason)
Comment 2 Adrian Chadd freebsd_committer 2015-09-14 20:04:48 UTC
What exactly is the difference? Is this the PCIe version?
Comment 3 Jung-uk Kim freebsd_committer 2015-09-14 21:29:33 UTC
(In reply to Adrian Chadd from comment #2)
Yes, it seems so:

http://www.realtek.com/products/productsView.aspx?Langid=1&PFid=48&Level=5&Conn=4&ProdID=272
Comment 4 Adrian Chadd freebsd_committer 2015-09-14 21:36:09 UTC
They're almost the same chips though. How similar are the drivers?
Comment 5 Kevin Lo freebsd_committer 2015-09-17 14:47:44 UTC
Well, I remember someone would send this wifi card to me, but unfortunately, 
I haven't received it yet.  Porting OpenBSD's rtwn(4) to FreeBSD is not hard,
the harder part would be maintaining rtwn(4) stability and performance.
Comment 6 Tony Narlock 2015-09-22 00:08:45 UTC
(In reply to Kevin Lo from comment #5)

Sorry for the late response, I meant to get back to this during the weekend.

I am reading FreeBSD Device Drivers, TDAIOTFOS, https://wiki.freebsd.org/WiFi, https://wiki.freebsd.org/WifiTxNotes, https://wiki.freebsd.org/WiFiDebugging and have an Thinkpad x230 with this card. 

I'm looking at if_urtwn.c. What other places do you think would be helpful to look at? I'm wondering if_urtwn.c may not be such a good example since it has USB everywhere.

It may be too tall of an order to port something like this over by myself.

> the harder part would be maintaining rtwn(4) stability and performance.

What would that entail?

Is it looking at coredumps if the kernel panics, running it on a machine until certain conditions popup, finding where in the code it's happening, trying to tweak it, recompiling, kldunload, kldload? Looking over tickets for behavior for the driver and trying to ask for more info to recreate it?

Do we have an irc channel for freebsd-wireless?
Comment 7 Adrian Chadd freebsd_committer 2015-09-29 00:13:32 UTC
yup, #freebsd-wifi on efnet.

Kevin/I have talked about taking urtwn and turning it into a standalone driver that we can start making into a HAL structure. I'd rather we did that and then added the PCIe bits to it versus maintaining multiple almost-the-same drivers.

Hows that sound to you?
Comment 8 Michael Zhilin 2015-09-30 07:50:02 UTC
Hi,

I have Lenovo T530i with RTL8188CE driver, so I'll one of tester for this ticket. :) 
none2@pci0:3:0:0:	class=0x028000 card=0x819510ec chip=0x817610ec rev=0x01 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8188CE 802.11b/g/n WiFi Adapter'
    class      = network
Comment 9 gardnerbell 2015-10-15 16:40:34 UTC
I have a toshiba satellite with this card and would be happy to test when a driver becomes available.

none2@pci0:3:0:0:	class=0x028000 card=0x819510ec chip=0x817610ec rev=0x01 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8188CE 802.11b/g/n WiFi Adapter'
    class      = network
Comment 10 Kevin Lo freebsd_committer 2015-10-20 15:16:34 UTC
I finally got my rtl8188ce wifi adapter.  I'm working on it, 
please stay tuned!
Comment 11 Alex.R.Laurie 2015-11-06 01:25:22 UTC
I have a Lenovo SL510 with a rtl8188CE. Currently running OpenBSD-Current on it and the driver is working well. I'd be happy to test on FreeBSD.
Comment 12 evil.lombo 2015-11-11 10:24:53 UTC
Me too willing to help, with a HP Pavillon g6 and the dreadful RTL8188CE. It used to work somehow with NDIS but with some annoying quirks.
Comment 13 Christian Brueffer freebsd_committer 2016-01-04 18:50:15 UTC
Just to keep the records up to date, adrian committed a preliminary driver to HEAD in r293010.
Comment 14 Tony Narlock 2016-01-07 23:48:44 UTC
(In reply to Christian Brueffer from comment #13)
Yep, we have a start!

On a Thinkpad x230 I am able to connect to connect to my network via WPA2 and ping an external domain, load a page or two also.

FreeBSD x230 11.0-CURRENT FreeBSD 11.0-CURRENT #11: Sun Jan  3 04:21:01 CST 2016     root@x230:/usr/obj/usr/src/sys/GENERIC  amd64 amd64 1100093 1100093

I will follow up with more soon
Comment 15 evil.lombo 2016-01-10 14:12:36 UTC
Hi,

tried the module and the card was detected fine and it's working.

So far I get three issues with it:
- WPA2 authentication seems to work only the first time to me. If I stop wpa_supplicant or put down the wifi card via ifconfig, the further authenticaitona fails for expired timeout.
-Speed seems limited to 16Mbps rate (around 120 kbps on downstream),even though the ifconfig summary show 802.11g/56mbps.
- After heavy usage, it stops working and dmesg shows a "rtwn0: can't map to rbuf (error: 12)" (12 = ENOMEM) and after some mins of this error, the kernel panics. I can't restore the wifi status via ifconfig and I have to reboot the laptop.

Which kind of info do you need for troubleshooting?

Thanks,
Simone
Comment 16 Andriy Voskoboinyk freebsd_committer 2016-01-10 15:18:10 UTC
(In reply to Simone Mario Lombardo from comment #15)
Hi,

> - WPA2 authentication seems to work only the first time to me. If I stop 
> wpa_supplicant or put down the wifi card via ifconfig, the further 
> authenticaitona fails for expired timeout.

Can you test the patch from https://reviews.freebsd.org/D4820 ? It should fix this issue.

Also,

> or put down the wifi card via ifconfig

If I understand this correctly (ifconfig wlan0 down; ifconfig wlan0 up), then you will need to restart wpa_supplicant too (wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf) (+ 'dhclient wlan0' for DHCP); or just recreate the interface (ifconfig wlan0 down && ifconfig wlan0 destroy && ifconfig wlan0 create wlandev rtwn0)
Comment 17 Adrian Chadd freebsd_committer 2016-01-10 16:25:35 UTC
Please open a new problem report for bugs. :-) This one was just for "port driver!"

Thanks!


-a
Comment 18 commit-hook freebsd_committer 2016-02-21 18:52:19 UTC
A commit references this bug:

Author: avos
Date: Sun Feb 21 18:51:49 UTC 2016
New revision: 295865
URL: https://svnweb.freebsd.org/changeset/base/295865

Log:
  rtwn: import r290048.

  - Fix scanning from AUTH state.

  Tested by: Simone Mario Lombardo <evil.lombo@gmail.com>

  PR:		203105
  Reviewed by:	kevlo
  Approved by:	adrian (mentor)
  Differential Revision:	https://reviews.freebsd.org/D4820

Changes:
  head/sys/dev/rtwn/if_rtwn.c