Deleted Added
sdiff udiff text old ( 172060 ) new ( 172211 )
full compact
1/* $FreeBSD: head/sys/dev/ral/rt2560.c 172060 2007-09-05 23:00:27Z sam $ */
2
3/*-
4 * Copyright (c) 2005, 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/rt2560.c 172060 2007-09-05 23:00:27Z sam $");
22
23/*-
24 * Ralink Technology RT2560 chipset driver
25 * http://www.ralinktech.com/
26 */
27
28#include <sys/param.h>
29#include <sys/sysctl.h>

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

100static int rt2560_newstate(struct ieee80211com *,
101 enum ieee80211_state, int);
102static uint16_t rt2560_eeprom_read(struct rt2560_softc *, uint8_t);
103static void rt2560_encryption_intr(struct rt2560_softc *);
104static void rt2560_tx_intr(struct rt2560_softc *);
105static void rt2560_prio_intr(struct rt2560_softc *);
106static void rt2560_decryption_intr(struct rt2560_softc *);
107static void rt2560_rx_intr(struct rt2560_softc *);
108static void rt2560_beacon_expire(struct rt2560_softc *);
109static void rt2560_wakeup_expire(struct rt2560_softc *);
110static uint8_t rt2560_rxrate(struct rt2560_rx_desc *);
111static int rt2560_ack_rate(struct ieee80211com *, int);
112static void rt2560_scan_start(struct ieee80211com *);
113static void rt2560_scan_end(struct ieee80211com *);
114static void rt2560_set_channel(struct ieee80211com *);
115static uint16_t rt2560_txtime(int, int, uint32_t);

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

296 ic->ic_reset = rt2560_reset;
297 /* enable s/w bmiss handling in sta mode */
298 ic->ic_flags_ext |= IEEE80211_FEXT_SWBMISS;
299
300 /* override state transition machine */
301 sc->sc_newstate = ic->ic_newstate;
302 ic->ic_newstate = rt2560_newstate;
303 ic->ic_raw_xmit = rt2560_raw_xmit;
304 ieee80211_media_init(ic, rt2560_media_change, ieee80211_media_status);
305
306 bpfattach2(ifp, DLT_IEEE802_11_RADIO,
307 sizeof (struct ieee80211_frame) + sizeof (sc->sc_txtap),
308 &sc->sc_drvbpf);
309
310 sc->sc_rxtap_len = sizeof sc->sc_rxtap;
311 sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len);

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

775 if (ic->ic_opmode != IEEE80211_M_MONITOR) {
776 rt2560_update_plcp(sc);
777 rt2560_set_basicrates(sc);
778 rt2560_set_bssid(sc, ni->ni_bssid);
779 }
780
781 if (ic->ic_opmode == IEEE80211_M_HOSTAP ||
782 ic->ic_opmode == IEEE80211_M_IBSS) {
783 m = ieee80211_beacon_alloc(ic, ni, &sc->sc_bo);
784 if (m == NULL) {
785 device_printf(sc->sc_dev,
786 "could not allocate beacon\n");
787 error = ENOBUFS;
788 break;
789 }
790
791 ieee80211_ref_node(ni);

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

1272
1273 bus_dmamap_sync(sc->rxq.desc_dmat, sc->rxq.desc_map,
1274 BUS_DMASYNC_PREWRITE);
1275
1276 /* kick decrypt */
1277 RAL_WRITE(sc, RT2560_SECCSR0, RT2560_KICK_DECRYPT);
1278}
1279
1280/*
1281 * This function is called periodically in IBSS mode when a new beacon must be
1282 * sent out.
1283 */
1284static void
1285rt2560_beacon_expire(struct rt2560_softc *sc)
1286{
1287 struct ieee80211com *ic = &sc->sc_ic;

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

1296 * Don't send beacon if bsschan isn't set
1297 */
1298 if (data->ni == NULL)
1299 return;
1300
1301 bus_dmamap_sync(sc->bcnq.data_dmat, data->map, BUS_DMASYNC_POSTWRITE);
1302 bus_dmamap_unload(sc->bcnq.data_dmat, data->map);
1303
1304 ieee80211_beacon_update(ic, data->ni, &sc->sc_bo, data->m, 1);
1305
1306 if (bpf_peers_present(ic->ic_rawbpf))
1307 bpf_mtap(ic->ic_rawbpf, data->m);
1308
1309 rt2560_tx_bcn(sc, data->m, data->ni);
1310
1311 DPRINTFN(15, ("beacon expired\n"));
1312

--- 1571 unchanged lines hidden ---