summaryrefslogtreecommitdiff
path: root/sys/dev/ic/rtwn.c
AgeCommit message (Collapse)Author
2023-04-28Add support for RTL8188FTV chip to urtwn(4).Kevin Lo
Tested with Comfast CF-WU710N v4. "go ahead" deraadt@ OK stsp@
2023-04-27Fix logic error in rtwn_r92e_get_txpower().Kevin Lo
The RTL8192EU is up to two stream TX/RX (so MCS0->15). ok stsp@
2023-04-27Whitespace fixKevin Lo
2022-12-27Fix array bounds mismatch with clang 15Patrick Wildt
New warning -Warray-parameter is a bit overzealous. ok millert@ tb@
2022-08-21A couple of minor changes for rtl8192eu:Kevin Lo
- enable Tx/Rx aggregations of individual 802.11 frames on the USB bus - in urtwn_fw_loadpage(), the maximum block size is 254 bytes rather than 196 bytes - clear the interrupt status register - no need to disable BAR for USB devices and set NAV limit ok stsp@, jmatthew@
2022-01-09spellingJonathan Gray
feedback and ok tb@ jmc@ ok ratchov@
2020-07-10Change users of IFQ_DEQUEUE(), IFQ_ENQUEUE() and IFQ_LEN() to use thePatrick Wildt
"new" API. ok dlg@ tobhe@
2020-06-11Make use of hardware crypto for CCMP. The tricky bits had been lyingJonathan Matthew
dormant in the driver for years, we just needed to insert the IV before transmission and do packet number checks on received frames. tested by kevlo@ solene@ benno@ and me on a variety of hardware ok kevlo@ stsp@
2020-01-09Convert sleeps of 1sec or more to tsleep_nsec(9).Martin Pieuchot
ok bluhm@
2019-12-31Convert infinite sleeps to {m,t}sleep_nsec(9).Martin Pieuchot
ok kn@
2019-11-16- Don't enable/disable efuse access protection for rtl8188c/rtl8192c;Kevin Lo
it may prevent incorrect mac address read from efuse - Disable BB/RF is not needed in urtwn_r92c_power_on() ok stsp@
2019-04-25Follow up on jmatthew's suggestion:Kevin Lo
in x_media_change(), return the errno from ieee80211_media_change() and do the error check from x_init(). ok stsp@, jmatthew@, phessler@
2019-03-11- in rtwn_r88e_fw_reset function, use the correct bit R88E_RSV_CTRL_MCU_RSTKevin Lo
to reset/enable MCU - there's no need to enable 1.2V power for rtl8192eu ok jmatthew@
2019-01-29Accept control frames in monitor mode.Kevin Lo
Based on a diff from Jesper Wallin. ok jmatthew@, stsp@
2018-12-07Handle 2 Tx chains in the computation of transmit power for the RTL8192EU.Kevin Lo
While here sort vendors. Tested by jmatthew@ ok stsp@, jmatthew@
2018-12-04Add support for RTL8192EU adapters, partly taken from netbsd.Jonathan Matthew
These show up with a variety of vendor/product ids, but the driver will only match those we've tested so far. help and testing from kevlo@ ok stsp@ kevlo@
2018-10-04Force 8051 reset/enable before waiting for firmware to get ready forKevin Lo
RTL8723AE, like we alreay do for RTL8188C/RTL8192C. ok jmatthew@
2018-10-01add RTL8723AE supportJonathan Matthew
ok kevlo@ stsp@
2018-09-28Move the unions into the rom struct which fixes Coverity CID 1473649 andKevin Lo
makes it more readable. ok stsp@ and jmatthew@
2018-09-21Add support for RTL8188EE.Jonathan Matthew
This needs a new firmware image, which should be added to the rtwn firmware package shortly. testing and lots of help from kevlo@ ok kevlo@ stsp@
2018-09-13- There's no need to set R92C_HSSI_PARAM2_READ_EDGE for R92C_HSSI_PARAM2(0)Kevin Lo
for rtl8188eu - Fix typo in structure r92c_rom in comment: s/0x8192/0x8129/ - Add id member to struct r88e_rom which identifies eeprom - Replace magic numbers with something more readable - Cosmetic tweaking ok stsp@
2017-10-26Move common code to add/remove multicast filters to ieee80211_ioctl(9).Martin Pieuchot
ok jsg@, stsp@
2017-09-23Fix build on octeon by reverting two cosmetic changes in rtwn.c r1.34.Stefan Sperling
Compiler complained: warning: large integer implicitly truncated to unsigned type No functional change. reported by & ok visa@
2017-09-22- Fix short preamble for rtl8188euKevin Lo
- Use R92C_MSR rather than R92C_CR to set media status - Replace magic numbers with something more readable ok stsp@
2017-08-23Fix up rssi calculations and r88e_rx_cck structure for RTL8188EU.Kevin Lo
Tested with TL-WN725N v2 (rtl8188eu) on amd64. ok stsp@
2017-08-21Fix the build when RTWN_DEBUG is defined.Jonathan Gray
ok kettenis@ stsp@
2017-08-20Surprise: I/Q calibration now works with urtwn(4) devices, so enable it.Stefan Sperling
Tested with 8188CUS, 8188EU, and 8192CU.
2017-08-20Fix use of uninitialized variables during rtwn(4) I/Q calibration, whichStefan Sperling
restored device registers from uninitialized memory after calibration. Bug was hinted at by clang which produced a non-working driver at -O2. The problem was eventually spotted by jsg@ with gcc 6.3.1.
2017-08-19Remove a redundant declaration of rtwn_update_avgrssi().Stefan Sperling
It is also declared in rtwnvar.h. No functional change.
2017-08-16Mostly cosmetic changes to make things a bit more consistant:Kevin Lo
- rename bit definition of R88E_TX_RPT1_ENA to reflect reality - no need to set R92C_FPGA0_ANAPARAM2 for 40mhz for rtl8188eu - in rtwn_write_txpower(), writing to MCS8-15 power registers if the WNIC has 2 spatial streams ok stsp@
2017-08-14Fix CID 1452952: Unlikely use of uninitialized offset in rtwn_efuse_read().Stefan Sperling
While here, unwrap some lines which fit 80 columns. ok kevlo@
2017-07-08- For RTL8188CUS/RTL8192CU, we have to force 8051 reset/enable before waitingKevin Lo
for firmware to get ready. It fixes "urtwn0: could not load firmware page" while running stsp@'s script: dhclient urtwn0; ifconfig urtwn0 down; ifconfig urtwn0 scan in a loop. - Minor cleanup for rtwn_read_rom()/rtwn_get_txpower(); no need to use callbacks. Tested by stsp@ and me. ok stsp@
2017-07-02Add the definition of IEEE80211_DUR_DS_SHSLOT.Kevin Lo
From IEEE Std. 802.11-2016, Table 18-5 "ERP characteristics", p. 2332: aSlotTime characteristic: If dont11OperatingClassesRequired is false: Long = 20 us Short = 9 us ok stsp@
2017-07-01- Avoid possible use of uninitialized variable; noticed by jsg@Kevin Lo
- Only set value in R92C_FAST_EDCA_CTRL register if the device is combo WiFi/Bluetooth; confirmed by Yan-Hsuan Chuan from Realtek - There's no need to set the default value for the R92C_PIFS since default value is 0x1c; confirmed by Yan-Hsuan Chuan from Realtek - Disable usb Rx aggregation mode for rtl8188cu/rtl8192cu; vendor drivers use DMA Rx aggregation mode for rtl8188cu/rtl8192cu/rtl8188eu and use USB Rx aggregation mode for later chipsets. Tested by stsp and me. ok stsp@
2017-06-23- Fix Tx queues to USB endpoints mapping and merge urtwn_r92c_dma_init()Kevin Lo
and urtwn_r88e_dma_init() into one; from FreeBSD r291902. - Change the way the number of pages for public queue is calculated; Based on the vendor driver's _InitQueueReservedPage(), the formula for calculation of the number of pages for public priority queue is as follows: if the device has 3 endpoints: PUBQ = total number of Tx pages - HQ - LQ - NQ if the device has 2 endpoints (i.e. has high and normal priority queues): PUBQ = total number of Tx pages - HQ - NQ - Don't write MCS8..MCS15 Tx power if the WNIC is a 1-stream Tx; - Set R88E_TX_PAGE_COUNT to a correct value; - Minimal enhancement in urtwn_open_pipes() for upcoming rtl8192eu chipset support; Tested with USB-N10 Nano (rtl8188cu), DWA-131 rev B (rtl8192cu), and TL-WN725N v2 (rtl8188eu) on amd64. ok stsp@
2017-06-16- Fix incorrect values in the computation of transmit power for theKevin Lo
rtl8188eu chipset. - Small code refactoring: - replace hardcoded rate indexes with their name, like athn(4). - replace fields offsets with the structure; from FreeBSD r294198. - be compliant with definitions of the efuse in vendor hal_pg.h and rename struct r92c_rom member names: s/channel_plan/reserved5/, s/xtal_calib/channel_plan. - no need to disable HWPDN twice in urtwn_r88e_power_on(). Tested by stsp@ and myself with RTL8188CUS, RTL8192CU, RTL8188EU, and RTL8188CE devices. ok stsp@
2017-05-19Repair rtwn(4) IQ calibration.Stefan Sperling
Restore behaviour from before the fix of the botched R92C_USTIME_TSF register definition. IQ cal code was referring to this register by name, but actually needs to use the old value. So add a register definition for the old value under a new name (R92C_BCN_CTRL1) and use this name in the IQ cal code. Discussed with Kevin Lo
2017-05-088192C is the only MIMO chip supported by this driver, all others are 1T1R.Ricardo Mestre
This diff corrects dmesg to properly show that all others are 1T1R, since right now it only applies to 8188C and all others incorrectly display 0T0R. hint & OK stsp@
2017-02-12Fix an uninitialised return value in rtwn_ra_init(). Though nothingJonathan Gray
currently tests the return value. ok stsp@
2017-02-01Add AMRR support to rtwn(4). Based on code from FreeBSD.Stefan Sperling
Works much better than firmware-based rate scaling in my testing. ok mpi@
2017-01-31Configure rtwn's ACMHWCTRL register correctly. Bits in this registerStefan Sperling
correspond to the flag stored in our stack as ac->ac_acm. ok mpi@
2017-01-31Clean up code in rtwn(4)/urtwn(4) which handles EDCA parameters:Stefan Sperling
Get EDCA params from net80211 instead of hardcoding them. Enable hardware management of EDCA AC queues. Handling of frame collisions with EDCA involves random backoffs. I found a register that looks like a seed for the pseudo-RNG involved in computing backoffs. Feed it with arc4random() during initialization. Add a comment to hint at the meaning of numbers written to SIFS registers, and rename some SIFS registers to better names found in Linux. ok mpi@
2017-01-30Make urtwn(4) run slot time updates from a USB task.Stefan Sperling
Fixes 'usbd_do_request: not in process context' warnings introduced recently. Fix reported and confirmed by Mikhail aka mp39590 aka misha
2017-01-30Make rtwn(4) and urtwn(4) tell the hardware about short preamble andStefan Sperling
short slot time settings. ok mpi@
2017-01-30Fix size passed to free(9)Jeremie Courreges-Anglas
ok tb@ stsp@
2017-01-26Fix rtwn(4) IQ calibration code (affects PCI devices only).Stefan Sperling
Some bits which probably should have been cleared were never cleared. Inspired by parts of FreeBSD's giant r307529 commit. Tested by myself on 8188CE PCI and jca@ on RTL8188RU USB.
2017-01-08Make urtwn(4) use AMRR instead of letting the firmware handle rate scaling.Stefan Sperling
For now this only affects RTL8188EU chips, perhaps because the author of this patch does not own any devices containing any of the other chips (hint hint). Patch by misha aka Mikhail / mp39590 at gmail ok mpi@
2016-07-26Fix byteswap errors in rtwn(4) and urtwn(4) introduced by me on June 17.Stefan Sperling
Repairs urtwn(4) on macppc. Problem reported by juanfra@. ok millert@ deraadt@
2016-06-17Merge a lot of code from urtwn(4) into rtwn(4). Both drivers now share codeStefan Sperling
in the file sys/dev/ic/rtwn.c. This reduces kernel bloat and will make it easier to have both drivers benefit from future enhancements. ok mpi@
2016-06-05Continue preparing a future merge of urtwn(4) and rtwn(4).Stefan Sperling
This mostly copies r88e support code to ic/rtwn.c and moves some functions which are not trivial to merge with USB counterparts back to pci/if_rtwn.c. ok mpi@