Deleted Added
full compact
rt2661.c (192468) rt2661.c (195618)
1/* $FreeBSD: head/sys/dev/ral/rt2661.c 192468 2009-05-20 20:00:40Z sam $ */
1/* $FreeBSD: head/sys/dev/ral/rt2661.c 195618 2009-07-11 15:02:45Z rpaulo $ */
2
3/*-
4 * Copyright (c) 2006
5 * Damien Bergamini <damien.bergamini@free.fr>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#include <sys/cdefs.h>
2
3/*-
4 * Copyright (c) 2006
5 * Damien Bergamini <damien.bergamini@free.fr>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#include <sys/cdefs.h>
21__FBSDID("$FreeBSD: head/sys/dev/ral/rt2661.c 192468 2009-05-20 20:00:40Z sam $");
21__FBSDID("$FreeBSD: head/sys/dev/ral/rt2661.c 195618 2009-07-11 15:02:45Z rpaulo $");
22
23/*-
24 * Ralink Technology RT2561, RT2561S and RT2661 chipset driver
25 * http://www.ralinktech.com/
26 */
27
28#include <sys/param.h>
29#include <sys/sysctl.h>

--- 252 unchanged lines hidden (view full) ---

282 /* set device capabilities */
283 ic->ic_caps =
284 IEEE80211_C_STA /* station mode */
285 | IEEE80211_C_IBSS /* ibss, nee adhoc, mode */
286 | IEEE80211_C_HOSTAP /* hostap mode */
287 | IEEE80211_C_MONITOR /* monitor mode */
288 | IEEE80211_C_AHDEMO /* adhoc demo mode */
289 | IEEE80211_C_WDS /* 4-address traffic works */
22
23/*-
24 * Ralink Technology RT2561, RT2561S and RT2661 chipset driver
25 * http://www.ralinktech.com/
26 */
27
28#include <sys/param.h>
29#include <sys/sysctl.h>

--- 252 unchanged lines hidden (view full) ---

282 /* set device capabilities */
283 ic->ic_caps =
284 IEEE80211_C_STA /* station mode */
285 | IEEE80211_C_IBSS /* ibss, nee adhoc, mode */
286 | IEEE80211_C_HOSTAP /* hostap mode */
287 | IEEE80211_C_MONITOR /* monitor mode */
288 | IEEE80211_C_AHDEMO /* adhoc demo mode */
289 | IEEE80211_C_WDS /* 4-address traffic works */
290 | IEEE80211_C_MBSS /* mesh point link mode */
290 | IEEE80211_C_SHPREAMBLE /* short preamble supported */
291 | IEEE80211_C_SHSLOT /* short slot time supported */
292 | IEEE80211_C_WPA /* capable of WPA1+WPA2 */
293 | IEEE80211_C_BGSCAN /* capable of bg scanning */
294#ifdef notyet
295 | IEEE80211_C_TXFRAG /* handle tx frags */
296 | IEEE80211_C_WME /* 802.11e */
297#endif

--- 84 unchanged lines hidden (view full) ---

382 struct ieee80211vap *vap;
383
384 switch (opmode) {
385 case IEEE80211_M_STA:
386 case IEEE80211_M_IBSS:
387 case IEEE80211_M_AHDEMO:
388 case IEEE80211_M_MONITOR:
389 case IEEE80211_M_HOSTAP:
291 | IEEE80211_C_SHPREAMBLE /* short preamble supported */
292 | IEEE80211_C_SHSLOT /* short slot time supported */
293 | IEEE80211_C_WPA /* capable of WPA1+WPA2 */
294 | IEEE80211_C_BGSCAN /* capable of bg scanning */
295#ifdef notyet
296 | IEEE80211_C_TXFRAG /* handle tx frags */
297 | IEEE80211_C_WME /* 802.11e */
298#endif

--- 84 unchanged lines hidden (view full) ---

383 struct ieee80211vap *vap;
384
385 switch (opmode) {
386 case IEEE80211_M_STA:
387 case IEEE80211_M_IBSS:
388 case IEEE80211_M_AHDEMO:
389 case IEEE80211_M_MONITOR:
390 case IEEE80211_M_HOSTAP:
391 case IEEE80211_M_MBSS:
392 /* XXXRP: TBD */
390 if (!TAILQ_EMPTY(&ic->ic_vaps)) {
391 if_printf(ifp, "only 1 vap supported\n");
392 return NULL;
393 }
394 if (opmode == IEEE80211_M_STA)
395 flags |= IEEE80211_CLONE_NOBEACONS;
396 break;
397 case IEEE80211_M_WDS:

--- 415 unchanged lines hidden (view full) ---

813 if (vap->iv_opmode != IEEE80211_M_MONITOR) {
814 rt2661_enable_mrr(sc);
815 rt2661_set_txpreamble(sc);
816 rt2661_set_basicrates(sc, &ni->ni_rates);
817 rt2661_set_bssid(sc, ni->ni_bssid);
818 }
819
820 if (vap->iv_opmode == IEEE80211_M_HOSTAP ||
393 if (!TAILQ_EMPTY(&ic->ic_vaps)) {
394 if_printf(ifp, "only 1 vap supported\n");
395 return NULL;
396 }
397 if (opmode == IEEE80211_M_STA)
398 flags |= IEEE80211_CLONE_NOBEACONS;
399 break;
400 case IEEE80211_M_WDS:

--- 415 unchanged lines hidden (view full) ---

816 if (vap->iv_opmode != IEEE80211_M_MONITOR) {
817 rt2661_enable_mrr(sc);
818 rt2661_set_txpreamble(sc);
819 rt2661_set_basicrates(sc, &ni->ni_rates);
820 rt2661_set_bssid(sc, ni->ni_bssid);
821 }
822
823 if (vap->iv_opmode == IEEE80211_M_HOSTAP ||
821 vap->iv_opmode == IEEE80211_M_IBSS) {
824 vap->iv_opmode == IEEE80211_M_IBSS ||
825 vap->iv_opmode == IEEE80211_M_MBSS) {
822 error = rt2661_prepare_beacon(sc, vap);
823 if (error != 0)
824 return error;
825 }
826 if (vap->iv_opmode != IEEE80211_M_MONITOR)
827 rt2661_enable_tsf_sync(sc);
828 else
829 rt2661_enable_tsf(sc);

--- 1593 unchanged lines hidden (view full) ---

2423
2424 /* update Rx filter */
2425 tmp = RAL_READ(sc, RT2661_TXRX_CSR0) & 0xffff;
2426
2427 tmp |= RT2661_DROP_PHY_ERROR | RT2661_DROP_CRC_ERROR;
2428 if (ic->ic_opmode != IEEE80211_M_MONITOR) {
2429 tmp |= RT2661_DROP_CTL | RT2661_DROP_VER_ERROR |
2430 RT2661_DROP_ACKCTS;
826 error = rt2661_prepare_beacon(sc, vap);
827 if (error != 0)
828 return error;
829 }
830 if (vap->iv_opmode != IEEE80211_M_MONITOR)
831 rt2661_enable_tsf_sync(sc);
832 else
833 rt2661_enable_tsf(sc);

--- 1593 unchanged lines hidden (view full) ---

2427
2428 /* update Rx filter */
2429 tmp = RAL_READ(sc, RT2661_TXRX_CSR0) & 0xffff;
2430
2431 tmp |= RT2661_DROP_PHY_ERROR | RT2661_DROP_CRC_ERROR;
2432 if (ic->ic_opmode != IEEE80211_M_MONITOR) {
2433 tmp |= RT2661_DROP_CTL | RT2661_DROP_VER_ERROR |
2434 RT2661_DROP_ACKCTS;
2431 if (ic->ic_opmode != IEEE80211_M_HOSTAP)
2435 if (ic->ic_opmode != IEEE80211_M_HOSTAP &&
2436 ic->ic_opmode != IEEE80211_M_MBSS)
2432 tmp |= RT2661_DROP_TODS;
2433 if (!(ifp->if_flags & IFF_PROMISC))
2434 tmp |= RT2661_DROP_NOT_TO_ME;
2435 }
2436
2437 RAL_WRITE(sc, RT2661_TXRX_CSR0, tmp);
2438
2439 /* clear STA registers */

--- 434 unchanged lines hidden ---
2437 tmp |= RT2661_DROP_TODS;
2438 if (!(ifp->if_flags & IFF_PROMISC))
2439 tmp |= RT2661_DROP_NOT_TO_ME;
2440 }
2441
2442 RAL_WRITE(sc, RT2661_TXRX_CSR0, tmp);
2443
2444 /* clear STA registers */

--- 434 unchanged lines hidden ---