Deleted Added
full compact
if_ipw.c (260444) if_ipw.c (271849)
1/*-
2 * Copyright (c) 2004-2006
3 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
4 * Copyright (c) 2006 Sam Leffler, Errno Consulting
5 * Copyright (c) 2007 Andrew Thompson <thompsa@FreeBSD.org>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004-2006
3 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
4 * Copyright (c) 2006 Sam Leffler, Errno Consulting
5 * Copyright (c) 2007 Andrew Thompson <thompsa@FreeBSD.org>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/ipw/if_ipw.c 260444 2014-01-08 08:06:56Z kevlo $");
31__FBSDID("$FreeBSD: head/sys/dev/ipw/if_ipw.c 271849 2014-09-19 03:51:26Z glebius $");
32
33/*-
34 * Intel(R) PRO/Wireless 2100 MiniPCI driver
35 * http://www.intel.com/network/connectivity/products/wireless/prowireless_mobile.htm
36 */
37
38#include <sys/param.h>
39#include <sys/sysctl.h>

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

1197 /*
1198 * Try to allocate a new mbuf for this ring element and load it before
1199 * processing the current mbuf. If the ring element cannot be loaded,
1200 * drop the received packet and reuse the old mbuf. In the unlikely
1201 * case that the old mbuf can't be reloaded either, explicitly panic.
1202 */
1203 mnew = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
1204 if (mnew == NULL) {
32
33/*-
34 * Intel(R) PRO/Wireless 2100 MiniPCI driver
35 * http://www.intel.com/network/connectivity/products/wireless/prowireless_mobile.htm
36 */
37
38#include <sys/param.h>
39#include <sys/sysctl.h>

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

1197 /*
1198 * Try to allocate a new mbuf for this ring element and load it before
1199 * processing the current mbuf. If the ring element cannot be loaded,
1200 * drop the received packet and reuse the old mbuf. In the unlikely
1201 * case that the old mbuf can't be reloaded either, explicitly panic.
1202 */
1203 mnew = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
1204 if (mnew == NULL) {
1205 ifp->if_ierrors++;
1205 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
1206 return;
1207 }
1208
1209 bus_dmamap_sync(sc->rxbuf_dmat, sbuf->map, BUS_DMASYNC_POSTREAD);
1210 bus_dmamap_unload(sc->rxbuf_dmat, sbuf->map);
1211
1212 error = bus_dmamap_load(sc->rxbuf_dmat, sbuf->map, mtod(mnew, void *),
1213 MCLBYTES, ipw_dma_map_addr, &physaddr, 0);

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

1218 error = bus_dmamap_load(sc->rxbuf_dmat, sbuf->map,
1219 mtod(sbuf->m, void *), MCLBYTES, ipw_dma_map_addr,
1220 &physaddr, 0);
1221 if (error != 0) {
1222 /* very unlikely that it will fail... */
1223 panic("%s: could not load old rx mbuf",
1224 device_get_name(sc->sc_dev));
1225 }
1206 return;
1207 }
1208
1209 bus_dmamap_sync(sc->rxbuf_dmat, sbuf->map, BUS_DMASYNC_POSTREAD);
1210 bus_dmamap_unload(sc->rxbuf_dmat, sbuf->map);
1211
1212 error = bus_dmamap_load(sc->rxbuf_dmat, sbuf->map, mtod(mnew, void *),
1213 MCLBYTES, ipw_dma_map_addr, &physaddr, 0);

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

1218 error = bus_dmamap_load(sc->rxbuf_dmat, sbuf->map,
1219 mtod(sbuf->m, void *), MCLBYTES, ipw_dma_map_addr,
1220 &physaddr, 0);
1221 if (error != 0) {
1222 /* very unlikely that it will fail... */
1223 panic("%s: could not load old rx mbuf",
1224 device_get_name(sc->sc_dev));
1225 }
1226 ifp->if_ierrors++;
1226 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
1227 return;
1228 }
1229
1230 /*
1231 * New mbuf successfully loaded, update Rx ring and continue
1232 * processing.
1233 */
1234 m = sbuf->m;

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

1373 return;
1374
1375 r = CSR_READ_4(sc, IPW_CSR_TX_READ);
1376
1377 for (i = (sc->txold + 1) % IPW_NTBD; i != r; i = (i + 1) % IPW_NTBD) {
1378 sbd = &sc->stbd_list[i];
1379
1380 if (sbd->type == IPW_SBD_TYPE_DATA)
1227 return;
1228 }
1229
1230 /*
1231 * New mbuf successfully loaded, update Rx ring and continue
1232 * processing.
1233 */
1234 m = sbuf->m;

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

1373 return;
1374
1375 r = CSR_READ_4(sc, IPW_CSR_TX_READ);
1376
1377 for (i = (sc->txold + 1) % IPW_NTBD; i != r; i = (i + 1) % IPW_NTBD) {
1378 sbd = &sc->stbd_list[i];
1379
1380 if (sbd->type == IPW_SBD_TYPE_DATA)
1381 ifp->if_opackets++;
1381 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
1382
1383 ipw_release_sbd(sc, sbd);
1384 sc->txfree++;
1385 }
1386
1387 /* remember what the firmware has processed */
1388 sc->txold = (r == 0) ? IPW_NTBD - 1 : r - 1;
1389

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

1763 if (sc->txfree < 1 + IPW_MAX_NSEG) {
1764 IFQ_DRV_PREPEND(&ifp->if_snd, m);
1765 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
1766 break;
1767 }
1768 ni = (struct ieee80211_node *) m->m_pkthdr.rcvif;
1769 if (ipw_tx_start(ifp, m, ni) != 0) {
1770 ieee80211_free_node(ni);
1382
1383 ipw_release_sbd(sc, sbd);
1384 sc->txfree++;
1385 }
1386
1387 /* remember what the firmware has processed */
1388 sc->txold = (r == 0) ? IPW_NTBD - 1 : r - 1;
1389

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

1763 if (sc->txfree < 1 + IPW_MAX_NSEG) {
1764 IFQ_DRV_PREPEND(&ifp->if_snd, m);
1765 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
1766 break;
1767 }
1768 ni = (struct ieee80211_node *) m->m_pkthdr.rcvif;
1769 if (ipw_tx_start(ifp, m, ni) != 0) {
1770 ieee80211_free_node(ni);
1771 ifp->if_oerrors++;
1771 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
1772 break;
1773 }
1774 /* start watchdog timer */
1775 sc->sc_tx_timer = 5;
1776 }
1777}
1778
1779static void
1780ipw_watchdog(void *arg)
1781{
1782 struct ipw_softc *sc = arg;
1783 struct ifnet *ifp = sc->sc_ifp;
1784 struct ieee80211com *ic = ifp->if_l2com;
1785
1786 IPW_LOCK_ASSERT(sc);
1787
1788 if (sc->sc_tx_timer > 0) {
1789 if (--sc->sc_tx_timer == 0) {
1790 if_printf(ifp, "device timeout\n");
1772 break;
1773 }
1774 /* start watchdog timer */
1775 sc->sc_tx_timer = 5;
1776 }
1777}
1778
1779static void
1780ipw_watchdog(void *arg)
1781{
1782 struct ipw_softc *sc = arg;
1783 struct ifnet *ifp = sc->sc_ifp;
1784 struct ieee80211com *ic = ifp->if_l2com;
1785
1786 IPW_LOCK_ASSERT(sc);
1787
1788 if (sc->sc_tx_timer > 0) {
1789 if (--sc->sc_tx_timer == 0) {
1790 if_printf(ifp, "device timeout\n");
1791 ifp->if_oerrors++;
1791 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
1792 taskqueue_enqueue(taskqueue_swi, &sc->sc_init_task);
1793 }
1794 }
1795 if (sc->sc_scan_timer > 0) {
1796 if (--sc->sc_scan_timer == 0) {
1797 DPRINTFN(3, ("Scan timeout\n"));
1798 /* End the scan */
1799 if (sc->flags & IPW_FLAG_SCANNING) {

--- 926 unchanged lines hidden ---
1792 taskqueue_enqueue(taskqueue_swi, &sc->sc_init_task);
1793 }
1794 }
1795 if (sc->sc_scan_timer > 0) {
1796 if (--sc->sc_scan_timer == 0) {
1797 DPRINTFN(3, ("Scan timeout\n"));
1798 /* End the scan */
1799 if (sc->flags & IPW_FLAG_SCANNING) {

--- 926 unchanged lines hidden ---