Page MenuHomeFreeBSD

Adding rtl8188ee driver to rtwn(4)
ClosedPublic

Authored by farhan_farhan.codes on Jun 7 2018, 4:38 PM.

Details

Summary

Updated per guidance from Andriy Voskoboinyk from D15692
Attached Tx code to rtl8192ce, deleted rtl8188ee Tx code
Removed redundant r88ee_fw_download function
Removed redundant r88ee_reg.h registers
Replaced missing register names from hardcoded values
Minor hex representations

Test Plan

Load the driver, bring it up, capture frames with tcpdump
Load the driver as follows:
make -C /usr/src/sys/modules/rtwnfw load
make -C /usr/src/sys/modules/rtwn load
make -C /usr/src/sys/modules/rtwn_pci load

This should create an rtwn0 device. Create the wlan0 interface by running:
ifconfig wlan0 create wlandev rtwn0 wlanmode monitor channel 6:g
ifconfig wlan0 up

Adjust the WiFi channel to a local channel. Then I run this command to start
receiving data.
tcpdump -n -i wlan0 -y IEEE802_11_RADIO

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

I retrieved the rtl8188efw.bin firmware from here: https://github.com/lwfinger/rtlwifi_new/tree/master/firmware/rtlwifi
I uuencoded it with the following command:
uuencode rtl8188efw.bin rtwn-rtl8188eefw.fw.uu > rtwn-rtl8188eefw.fw.uu

thj added a reviewer: thj.Jun 8 2018, 7:45 AM

Hi,

Can you attach next patches with context (like it is described in https://wiki.freebsd.org/action/show/Phabricator?action=show&redirect=CodeReview )

Thanks!

sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c
158 ↗(On Diff #43423)

You can safely drop this comment and CAM_FIXED from here - it's not RTL8192C*

sys/dev/rtwn/rtl8188e/pci/r88ee_init.c
145 ↗(On Diff #43423)

It would be fine to add (macro) names for registers / bitfields if they are (but this can be done later)

sys/dev/rtwn/rtl8188e/pci/r88ee_tx.c
61 ↗(On Diff #43423)

I think, all functions from r92ce_tx.c are fine and can be just reused for this chip too.

sys/dev/rtwn/rtl8188e/pci/r88ee_tx_desc.h
29 ↗(On Diff #43423)

You can just reuse r92ce_tx_desc {} structure here (except there are some different PCIe fields, that you are going to add later)

sys/dev/rtwn/rtl8188e/r88e_fw.c
132 ↗(On Diff #43423)

This one looks like r92c_fw_download_enable(); I think it can be just replaced by it

farhan_farhan.codes updated this revision to Diff 43984.EditedJun 18 2018, 4:55 AM
farhan_farhan.codes marked 4 inline comments as done.
farhan_farhan.codes retitled this revision from rtl8188ee monitor mode driver to Adding rtl8188ee for rtwn(4) adding rtl8188ee.
farhan_farhan.codes edited the summary of this revision. (Show Details)
farhan_farhan.codes edited the test plan for this revision. (Show Details)

Attached Tx methods from rtl8192ce

Summary: Updated per guidance from Andriy Voskoboinyk from D15692
Attached Tx code to rtl8192ce, deleted rtl8188ee Tx code
Removed redundant r88ee_fw_download function
Removed redundant r88ee_reg.h registers
Replaced missing register names from hardcoded values
Minor hex representations

Test Plan: Load the driver, bring it up, capture frames with tcpdump
Load the driver as follows:
make -C /usr/src/sys/modules/rtwnfw load
make -C /usr/src/sys/modules/rtwn load
make -C /usr/src/sys/modules/rtwn_pci load

This should create an rtwn0 device. Create the wlan0 interface by running:
ifconfig wlan0 create wlandev rtwn0 wlanmode monitor channel 6:g
ifconfig wlan0 up

Adjust the WiFi channel to a local channel. Then I run this command to start
receiving data.
tcpdump -n -i wlan0 -y IEEE802_11_RADIO

Known Bug: Changes in r320725 causes the device go not properly come back up when
brought down. Data appears to come in sporadically, then stop.

Reviewers:

Subscribers:

farhan_farhan.codes retitled this revision from Adding rtl8188ee for rtwn(4) adding rtl8188ee to Adding rtl8188ee support for rtwn(4).Jun 18 2018, 8:42 AM
kevans added a subscriber: kevans.Jun 18 2018, 7:05 PM
farhan_farhan.codes retitled this revision from Adding rtl8188ee support for rtwn(4) to Updated per guidance from Andriy Voskoboinyk from D15692.
farhan_farhan.codes edited the summary of this revision. (Show Details)

Attached Tx methods from rtl8192ce

Summary: Updated per guidance from Andriy Voskoboinyk from D15692
Attached Tx code to rtl8192ce, deleted rtl8188ee Tx code
Removed redundant r88ee_fw_download function
Removed redundant r88ee_reg.h registers
Replaced missing register names from hardcoded values
Minor hex representations

Test Plan: Load the driver, bring it up, capture frames with tcpdump
Load the driver as follows:
make -C /usr/src/sys/modules/rtwnfw load
make -C /usr/src/sys/modules/rtwn load
make -C /usr/src/sys/modules/rtwn_pci load

This should create an rtwn0 device. Create the wlan0 interface by running:
ifconfig wlan0 create wlandev rtwn0 wlanmode monitor channel 6:g
ifconfig wlan0 up

Adjust the WiFi channel to a local channel. Then I run this command to start
receiving data.
tcpdump -n -i wlan0 -y IEEE802_11_RADIO

Known Bug: Changes in r320725 causes the device go not properly come back up when
brought down. Data appears to come in sporadically, then stop.

Reviewers:

Subscribers:

The previous commit was a diff from the previous diff.
That was a mistake, I am still getting used to the tooling.
This is a diff from HEAD.

sys/dev/rtwn/rtl8188e/pci/r88ee.h
57 ↗(On Diff #43423)

I just realized, I removed r88ee_set_led and r88ee_led.c.
Lines 56 and 57 can be removed.

sys/dev/rtwn/rtl8188e/pci/r88ee_init.c
145 ↗(On Diff #43423)

I attempted to search through the Linux and FreeBSD code for a matching register name, but some times I did not find one. Linux uses a lot of hard-coded values. In that situation, what do you suggest I do?

farhan_farhan.codes retitled this revision from Updated per guidance from Andriy Voskoboinyk from D15692 to Adding rtl8188ee driver to rtwn(4).Jun 21 2018, 7:39 PM
farhan_farhan.codes marked an inline comment as done.Jun 25 2018, 9:45 PM

Hey @s3erios_gmail.com, have you had a chance to poke at this again?

Hi all, any views done on this? Its been a little less than a month :)

Hi all,
Has anyone had a chance to review this?

Fixed a bug in the SRCTOP variable, for some reason it was .SRCTOP with a preceding period character.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 2 2019, 6:49 AM
Closed by commit rS342682: rtwn_pci(4): add support for RTL8188EE chipset. (authored by avos, committed by ). · Explain Why
This revision was automatically updated to reflect the committed changes.