rt2560.c (158651) | rt2560.c (159180) |
---|---|
1/* $FreeBSD: head/sys/dev/ral/rt2560.c 158651 2006-05-16 14:37:58Z phk $ */ | 1/* $FreeBSD: head/sys/dev/ral/rt2560.c 159180 2006-06-02 19:59:33Z csjp $ */ |
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> | 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 158651 2006-05-16 14:37:58Z phk $"); | 21__FBSDID("$FreeBSD: head/sys/dev/ral/rt2560.c 159180 2006-06-02 19:59:33Z csjp $"); |
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> --- 1190 unchanged lines hidden (view full) --- 1220 data->m = mnew; 1221 desc->physaddr = htole32(physaddr); 1222 1223 /* finalize mbuf */ 1224 m->m_pkthdr.rcvif = ifp; 1225 m->m_pkthdr.len = m->m_len = 1226 (le32toh(desc->flags) >> 16) & 0xfff; 1227 | 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> --- 1190 unchanged lines hidden (view full) --- 1220 data->m = mnew; 1221 desc->physaddr = htole32(physaddr); 1222 1223 /* finalize mbuf */ 1224 m->m_pkthdr.rcvif = ifp; 1225 m->m_pkthdr.len = m->m_len = 1226 (le32toh(desc->flags) >> 16) & 0xfff; 1227 |
1228 if (sc->sc_drvbpf != NULL) { | 1228 if (bpf_peers_present(sc->sc_drvbpf)) { |
1229 struct rt2560_rx_radiotap_header *tap = &sc->sc_rxtap; 1230 uint32_t tsf_lo, tsf_hi; 1231 1232 /* get timestamp (low and high 32 bits) */ 1233 tsf_hi = RAL_READ(sc, RT2560_CSR17); 1234 tsf_lo = RAL_READ(sc, RT2560_CSR16); 1235 1236 tap->wr_tsf = --- 104 unchanged lines hidden (view full) --- 1341 1342 data = &sc->bcnq.data[sc->bcnq.next]; 1343 1344 bus_dmamap_sync(sc->bcnq.data_dmat, data->map, BUS_DMASYNC_POSTWRITE); 1345 bus_dmamap_unload(sc->bcnq.data_dmat, data->map); 1346 1347 ieee80211_beacon_update(ic, data->ni, &sc->sc_bo, data->m, 1); 1348 | 1229 struct rt2560_rx_radiotap_header *tap = &sc->sc_rxtap; 1230 uint32_t tsf_lo, tsf_hi; 1231 1232 /* get timestamp (low and high 32 bits) */ 1233 tsf_hi = RAL_READ(sc, RT2560_CSR17); 1234 tsf_lo = RAL_READ(sc, RT2560_CSR16); 1235 1236 tap->wr_tsf = --- 104 unchanged lines hidden (view full) --- 1341 1342 data = &sc->bcnq.data[sc->bcnq.next]; 1343 1344 bus_dmamap_sync(sc->bcnq.data_dmat, data->map, BUS_DMASYNC_POSTWRITE); 1345 bus_dmamap_unload(sc->bcnq.data_dmat, data->map); 1346 1347 ieee80211_beacon_update(ic, data->ni, &sc->sc_bo, data->m, 1); 1348 |
1349 if (ic->ic_rawbpf != NULL) | 1349 if (bpf_peers_present(ic->ic_rawbpf)) |
1350 bpf_mtap(ic->ic_rawbpf, data->m); 1351 1352 rt2560_tx_bcn(sc, data->m, data->ni); 1353 1354 DPRINTFN(15, ("beacon expired\n")); 1355 1356 sc->bcnq.next = (sc->bcnq.next + 1) % RT2560_BEACON_RING_COUNT; 1357} --- 243 unchanged lines hidden (view full) --- 1601 segs, &nsegs, BUS_DMA_NOWAIT); 1602 if (error != 0) { 1603 device_printf(sc->sc_dev, "could not map mbuf (error %d)\n", 1604 error); 1605 m_freem(m0); 1606 return error; 1607 } 1608 | 1350 bpf_mtap(ic->ic_rawbpf, data->m); 1351 1352 rt2560_tx_bcn(sc, data->m, data->ni); 1353 1354 DPRINTFN(15, ("beacon expired\n")); 1355 1356 sc->bcnq.next = (sc->bcnq.next + 1) % RT2560_BEACON_RING_COUNT; 1357} --- 243 unchanged lines hidden (view full) --- 1601 segs, &nsegs, BUS_DMA_NOWAIT); 1602 if (error != 0) { 1603 device_printf(sc->sc_dev, "could not map mbuf (error %d)\n", 1604 error); 1605 m_freem(m0); 1606 return error; 1607 } 1608 |
1609 if (sc->sc_drvbpf != NULL) { | 1609 if (bpf_peers_present(sc->sc_drvbpf)) { |
1610 struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap; 1611 1612 tap->wt_flags = 0; 1613 tap->wt_rate = rate; 1614 tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq); 1615 tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags); 1616 tap->wt_antenna = sc->tx_ant; 1617 --- 40 unchanged lines hidden (view full) --- 1658 segs, &nsegs, 0); 1659 if (error != 0) { 1660 device_printf(sc->sc_dev, "could not map mbuf (error %d)\n", 1661 error); 1662 m_freem(m0); 1663 return error; 1664 } 1665 | 1610 struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap; 1611 1612 tap->wt_flags = 0; 1613 tap->wt_rate = rate; 1614 tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq); 1615 tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags); 1616 tap->wt_antenna = sc->tx_ant; 1617 --- 40 unchanged lines hidden (view full) --- 1658 segs, &nsegs, 0); 1659 if (error != 0) { 1660 device_printf(sc->sc_dev, "could not map mbuf (error %d)\n", 1661 error); 1662 m_freem(m0); 1663 return error; 1664 } 1665 |
1666 if (sc->sc_drvbpf != NULL) { | 1666 if (bpf_peers_present(sc->sc_drvbpf)) { |
1667 struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap; 1668 1669 tap->wt_flags = 0; 1670 tap->wt_rate = rate; 1671 tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq); 1672 tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags); 1673 tap->wt_antenna = sc->tx_ant; 1674 --- 202 unchanged lines hidden (view full) --- 1877 m_freem(m0); 1878 return error; 1879 } 1880 1881 /* packet header may have moved, reset our local pointer */ 1882 wh = mtod(m0, struct ieee80211_frame *); 1883 } 1884 | 1667 struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap; 1668 1669 tap->wt_flags = 0; 1670 tap->wt_rate = rate; 1671 tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq); 1672 tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags); 1673 tap->wt_antenna = sc->tx_ant; 1674 --- 202 unchanged lines hidden (view full) --- 1877 m_freem(m0); 1878 return error; 1879 } 1880 1881 /* packet header may have moved, reset our local pointer */ 1882 wh = mtod(m0, struct ieee80211_frame *); 1883 } 1884 |
1885 if (sc->sc_drvbpf != NULL) { | 1885 if (bpf_peers_present(sc->sc_drvbpf)) { |
1886 struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap; 1887 1888 tap->wt_flags = 0; 1889 tap->wt_rate = rate; 1890 tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq); 1891 tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags); 1892 tap->wt_antenna = sc->tx_ant; 1893 --- 62 unchanged lines hidden (view full) --- 1956 ifp->if_drv_flags |= IFF_DRV_OACTIVE; 1957 break; 1958 } 1959 IF_DEQUEUE(&ic->ic_mgtq, m0); 1960 1961 ni = (struct ieee80211_node *)m0->m_pkthdr.rcvif; 1962 m0->m_pkthdr.rcvif = NULL; 1963 | 1886 struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap; 1887 1888 tap->wt_flags = 0; 1889 tap->wt_rate = rate; 1890 tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq); 1891 tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags); 1892 tap->wt_antenna = sc->tx_ant; 1893 --- 62 unchanged lines hidden (view full) --- 1956 ifp->if_drv_flags |= IFF_DRV_OACTIVE; 1957 break; 1958 } 1959 IF_DEQUEUE(&ic->ic_mgtq, m0); 1960 1961 ni = (struct ieee80211_node *)m0->m_pkthdr.rcvif; 1962 m0->m_pkthdr.rcvif = NULL; 1963 |
1964 if (ic->ic_rawbpf != NULL) | 1964 if (bpf_peers_present(ic->ic_rawbpf)) |
1965 bpf_mtap(ic->ic_rawbpf, m0); 1966 1967 if (rt2560_tx_mgt(sc, m0, ni) != 0) 1968 break; 1969 1970 } else { 1971 if (ic->ic_state != IEEE80211_S_RUN) 1972 break; --- 19 unchanged lines hidden (view full) --- 1992 BPF_MTAP(ifp, m0); 1993 1994 m0 = ieee80211_encap(ic, m0, ni); 1995 if (m0 == NULL) { 1996 ieee80211_free_node(ni); 1997 continue; 1998 } 1999 | 1965 bpf_mtap(ic->ic_rawbpf, m0); 1966 1967 if (rt2560_tx_mgt(sc, m0, ni) != 0) 1968 break; 1969 1970 } else { 1971 if (ic->ic_state != IEEE80211_S_RUN) 1972 break; --- 19 unchanged lines hidden (view full) --- 1992 BPF_MTAP(ifp, m0); 1993 1994 m0 = ieee80211_encap(ic, m0, ni); 1995 if (m0 == NULL) { 1996 ieee80211_free_node(ni); 1997 continue; 1998 } 1999 |
2000 if (ic->ic_rawbpf != NULL) | 2000 if (bpf_peers_present(ic->ic_rawbpf)) |
2001 bpf_mtap(ic->ic_rawbpf, m0); 2002 2003 if (rt2560_tx_data(sc, m0, ni) != 0) { 2004 ieee80211_free_node(ni); 2005 ifp->if_oerrors++; 2006 break; 2007 } 2008 } --- 716 unchanged lines hidden --- | 2001 bpf_mtap(ic->ic_rawbpf, m0); 2002 2003 if (rt2560_tx_data(sc, m0, ni) != 0) { 2004 ieee80211_free_node(ni); 2005 ifp->if_oerrors++; 2006 break; 2007 } 2008 } --- 716 unchanged lines hidden --- |