Commit Graph

194 Commits

Author SHA1 Message Date
Hans Petter Selasky
198fc7c37f Fix a range check for maximum transmit length. The existing code was
off by 4 bytes in one case.

Approved by:	kevlo @
MFC after:	2 weeks
2014-01-31 22:42:26 +00:00
Kevin Lo
51fcfa2666 Fix comment. 2014-01-24 15:34:22 +00:00
Kevin Lo
56ae078529 Get rid of memmove(). It's not portable.
Tested on RT3071, RT3573, RT3570, RT3572, and RT5572.

Reviewed by:	hselasky
2014-01-24 09:17:29 +00:00
Hans Petter Selasky
2719d9c909 Revert r261014. Let Kevin fix it.
MFC after:	1 week
2014-01-23 10:18:28 +00:00
Hans Petter Selasky
2e74d8c857 - Fix some non-portable code with regard to endianness. Don't use memmove().
- Fix a range check for maximum transmit length.
- Fix read from missing field when transmitting data.

MFC after:	2 weeks
2014-01-22 09:57:26 +00:00
Kevin Lo
030dda5d1d Fix a logic error when checking if Tx power entries are greater than 31. 2014-01-11 14:48:16 +00:00
Kevin Lo
107f00c0b9 Use m_get2() instead of m_getcl().
Spotted by:	glebius
2014-01-10 14:47:20 +00:00
Kevin Lo
569dfed32c Use m_getcl() instead of MGETHDR/MCLGET macros.
Suggested by:	glebius
2014-01-10 02:47:20 +00:00
Kevin Lo
115ea7c105 Replace deprecated M_DONTWAIT with M_NOWAIT. 2014-01-09 01:48:33 +00:00
Kevin Lo
5945b5f5ab Rename definition of IEEE80211_FC1_WEP to IEEE80211_FC1_PROTECTED.
The origin of WEP comes from IEEE Std 802.11-1997 where it defines
whether the frame body of MAC frame has been encrypted using WEP
algorithm or not.
IEEE Std. 802.11-2007 changes WEP to Protected Frame, indicates
whether the frame is protected by a cryptographic encapsulation
algorithm.

Reviewed by:	adrian, rpaulo
2014-01-08 08:06:56 +00:00
Kevin Lo
7a7e01caa4 Add support for the MediaTek/Ralink RT3593 chipset.
Committed over the ZyXEL NWD2705 on amd64 with WPA.
2014-01-03 06:01:05 +00:00
Dimitry Andric
96106c9665 In sys/dev/usb/wlan/if_urtw.c, #if 0 a static const variable, which has
been unused since r198194.

MFC after:	3 days
2013-12-29 20:05:48 +00:00
Kevin Lo
959af34776 Add D-Link DWA-140 rev D1, another RT5372/run(4).
From Anton Mazunin.
2013-12-27 08:03:53 +00:00
Kevin Lo
7dc4b90e74 Some devices have a dual mode such as Tenda W326U and ZyXEL NWD2705,
add the product id and use a standard scsi eject.

Tested on the ZyXEL NWD2705 wlan dongle.
2013-12-24 07:02:05 +00:00
Kevin Lo
9df3ee0758 Use 'val' instead of 'val & 0xff' since the last argument of run_bbp_write()
is uint8_t.

Spotted by:	yongari
2013-12-18 08:53:40 +00:00
Kevin Lo
fd8fcee579 Fix style: add tab after #define. 2013-12-18 08:39:12 +00:00
Kevin Lo
c48c6bf8fc Fix typo in comment. 2013-12-18 07:47:50 +00:00
Kevin Lo
010b13fa94 Add support to IQ calibration. 2013-12-18 07:34:57 +00:00
Hans Petter Selasky
daab849b2c Fix compilation when the "USB_DEBUG" option is set. 2013-12-06 22:13:51 +00:00
Kevin Lo
242dbae34c Add support for the MediaTek/Ralink RT5572 chipset.
Committed over the TP-LINK TL-WDN3200 (RT5572) on amd64 with WPA.

While here, add my copyright.
2013-12-06 15:26:39 +00:00
Kevin Lo
e0790ad8eb Replace the magic numbers with something more readable. 2013-12-06 15:17:28 +00:00
Kevin Lo
b8161ff3c1 Cosmetic changes. 2013-12-06 15:15:58 +00:00
Kevin Lo
1d66c7a9cf Remove daft KASSERT. 2013-12-06 15:14:18 +00:00
Hans Petter Selasky
0aff597a1f Fix what looks like a typo after r258732. 2013-12-04 12:30:51 +00:00
Hans Petter Selasky
8cfe54400e Fix external compiler warning(s). Avoid pointer dereferencing. 2013-12-04 12:07:46 +00:00
Kevin Lo
405886883d The RUN_MAX_TXSZ constat is defined as Tx desc + Tx wireless info + MCLBYTES +
max padding.  We were lucky in that run(4) working fine since both
rt2860_rxwi and rt2860_txwi structure sizes are the same.
2013-12-02 09:07:43 +00:00
Eitan Adler
7a22215c53 Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this
shifts into the sign bit.  Instead use (1U << 31) which gets the
expected result.

This fix is not ideal as it assumes a 32 bit int, but does fix the issue
for most cases.

A similar change was made in OpenBSD.

Discussed with:	-arch, rdivacky
Reviewed by:	cperciva
2013-11-30 22:17:27 +00:00
Kevin Lo
5b7514646c Change run_rt2870_rf_write() prototype (no functional change) 2013-11-29 07:08:17 +00:00
Kevin Lo
5f7e329cec On the RT2870, rf registers are now 64-bit, not 32-bit after r257955.
Committed over a Buffalo WLI-UC-AG300N (RT2870).
2013-11-29 06:10:44 +00:00
Hans Petter Selasky
361f264ba0 Style changes. 2013-11-26 11:11:24 +00:00
Hans Petter Selasky
beb13f0407 Add missing static keyword.
MFC after:	2 weeks
2013-11-26 10:53:12 +00:00
Kevin Lo
0f3728be20 Remove a couple of unused macros. 2013-11-13 05:22:39 +00:00
Kevin Lo
28dfd8415b - Use bit twiddling macro to set IEEE80211_MODE_11A
- On the RT3572 chipset, there's no need to configure BBP register 86
2013-11-13 05:21:41 +00:00
Kevin Lo
bf124fcf1e Use the real product name for Edimax rsu(4) id. 2013-11-12 02:34:48 +00:00
Kevin Lo
67e73b2b2d Remove r257748 by accident. 2013-11-11 10:00:19 +00:00
Kevin Lo
64891211ca Add support for the MediaTek/Ralink RT5370/RT5372 chipset.
Tested with the TP-Link TL-WN727N (RT5370) and the D-Link DWA-140 (RT5372)
on i386/amd64/arm with WPA.
2013-11-11 09:47:33 +00:00
Hans Petter Selasky
415fd8a3dc Implement a working write region function to speed up loading of the
firmware. You can test this change by switching the "#if 1" statement
right above in the patched code to "#if 0" !

MFC after:	1 week
2013-11-06 15:32:37 +00:00
Hans Petter Selasky
bb2f69e83f Check for "ieee80211_vap_setup()" failure in all USB WLAN drivers.
MFC after:	1 week
2013-11-06 12:57:01 +00:00
Kevin Lo
ae7d66f220 Reading the RT2860_ASIC_VER_ID register is not needed and returns
completely bogus value.
2013-11-06 02:49:16 +00:00
Hans Petter Selasky
2764a2784f Protect the "ratectl_ch" callout in the "run" driver by the "run"
softc's "sc->sc_mtx" mutex. Currently the callout was marked
multi-processor safe, which is fine, but it is better to
start/stop/reset callouts while holding the "run" drivers own
mutex. While at it add a missing "ULL" at end of the 64-bit unsigned
integer constant.

MFC after:	1 week
2013-11-05 18:27:25 +00:00
Alfred Perlstein
50903998f0 Add device ID for 'Sanoxy 802.11N' usb 2013-11-02 11:37:16 +00:00
Hans Petter Selasky
645826bef4 Fix a potential memory leak.
MFC after:	1 week
2013-10-31 11:03:36 +00:00
Hans Petter Selasky
35a2489852 Fix some types. Compilation for external target complains that "u_int"
is not idential to "uint32_t" when defining set channel prototype
functions. The WLAN channel range should be from 0 to 65535
inclusivly, and u_int should be fine for this purpose.
2013-10-31 09:20:30 +00:00
Kevin Lo
30dfa97944 Add RT2860_BCN_OFFSET1 and RT2860_MAX_LEN_CFG register initialization to
match with the vendor driver.  While here, remove unused RT2860_DEF_MAC
definition.
2013-10-31 02:03:30 +00:00
Kevin Lo
1365315d41 Initialize BBP68 to improve rx sensitivity. 2013-10-31 02:02:14 +00:00
Kevin Lo
c513ecfd12 Enable DC filter in RT3071 Version E. 2013-10-31 02:00:58 +00:00
Gleb Smirnoff
76039bc84f The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare
to this event, adding if_var.h to files that do need it. Also, include
all includes that now are included due to implicit pollution via if_var.h

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2013-10-26 17:58:36 +00:00
Kevin Lo
d4d0412bc9 Fix the RT2860_TX_SW_CFG2 init value on older revisions of RT3070 chip. 2013-10-23 09:53:37 +00:00
Kevin Lo
d48971d0d2 Correct tx mixer gain value for RT3070 and RT3071.
Correctly value in EEPROM/EFUSE is one or more for RT3070 and
two or more for other RT3071 chips.
2013-10-18 07:48:20 +00:00
Kevin Lo
6bf8d884ad Since the DAC issue has been fixed in RT3070(F), the voltage raising fix
is no longer needed.
2013-10-18 07:46:28 +00:00