[haiku-commits] r34811 - in haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi: . dev/ath

  • From: coling@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 29 Dec 2009 19:24:35 +0100 (CET)

Author: colin
Date: 2009-12-29 19:24:35 +0100 (Tue, 29 Dec 2009)
New Revision: 34811
Changeset: http://dev.haiku-os.org/changeset/34811/haiku

Modified:
   
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_ath.c
   
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_athvar.h
   haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi/glue.c
Log:
* Using atomic operations to synchronize the interrupt status between glue code
  and ath_intr function. Those are faster than the HAIKU_INTR* macros.
* Some variable renaming to stick with common naming conventions of the other
  wlan drivers.


Modified: 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_ath.c
===================================================================
--- 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_ath.c
    2009-12-29 18:15:39 UTC (rev 34810)
+++ 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_ath.c
    2009-12-29 18:24:35 UTC (rev 34811)
@@ -42,9 +42,9 @@
 #include "opt_wlan.h"
 
 #include <sys/param.h>
-#include <sys/systm.h> 
+#include <sys/systm.h>
 #include <sys/sysctl.h>
-#include <sys/mbuf.h>   
+#include <sys/mbuf.h>
 #include <sys/malloc.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
@@ -60,7 +60,7 @@
 #include <sys/priv.h>
 
 #include <machine/bus.h>
- 
+
 #include <net/if.h>
 #include <net/if_dl.h>
 #include <net/if_media.h>
@@ -81,7 +81,7 @@
 #include <net/bpf.h>
 
 #ifdef INET
-#include <netinet/in.h> 
+#include <netinet/in.h>
 #include <netinet/if_ether.h>
 #endif
 
@@ -754,7 +754,7 @@
        DPRINTF(sc, ATH_DEBUG_ANY, "%s: if_flags %x\n",
                __func__, ifp->if_flags);
 
-       /* 
+       /*
         * NB: the order of these is important:
         * o stop the chip so no more interrupts will fire
         * o call the 802.11 layer before detaching the hal to
@@ -1280,11 +1280,8 @@
        struct ifnet *ifp = sc->sc_ifp;
        struct ath_hal *ah = sc->sc_ah;
        HAL_INT status;
-#ifdef __HAIKU__
-       HAIKU_INTR_REGISTER_STATE;
-#endif
 
-#ifndef __HAIKU__
+#if !defined(__HAIKU__)
        if (sc->sc_invalid) {
                /*
                 * The hardware is not ready/present, don't touch anything.
@@ -1312,10 +1309,8 @@
         * bits we haven't explicitly enabled so we mask the
         * value to insure we only process bits we requested.
         */
-#ifdef __HAIKU__
-       HAIKU_INTR_REGISTER_ENTER();
-       status = sc->sc_lastisr;
-       HAIKU_INTR_REGISTER_LEAVE();
+#if defined(__HAIKU__)
+       status = atomic_and((int32 *)&sc->sc_intr_status, 0);
 #else
        ath_hal_getisr(ah, &status);            /* NB: clears ISR too */
 #endif
@@ -1482,7 +1477,7 @@
        DPRINTF(sc, ATH_DEBUG_ANY, "%s: pending %u\n", __func__, pending);
 
        if (ath_hal_gethangstate(sc->sc_ah, 0xff, &hangs) && hangs != 0) {
-               if_printf(ifp, "bb hang detected (0x%x), reseting\n", hangs); 
+               if_printf(ifp, "bb hang detected (0x%x), reseting\n", hangs);
                ath_reset(ifp);
        } else
                ieee80211_beacon_miss(ifp->if_l2com);
@@ -1845,7 +1840,7 @@
                 * go out or none...
                 */
                STAILQ_INIT(&frags);
-               if ((m->m_flags & M_FRAG) && 
+               if ((m->m_flags & M_FRAG) &&
                    !ath_txfrag_setup(sc, &frags, m, ni)) {
                        DPRINTF(sc, ATH_DEBUG_XMIT,
                            "%s: out of txfrag buffers\n", __func__);
@@ -3352,7 +3347,7 @@
        }
 
        error = bus_dmamem_alloc(dd->dd_dmat, (void**) &dd->dd_desc,
-                                BUS_DMA_NOWAIT | BUS_DMA_COHERENT, 
+                                BUS_DMA_NOWAIT | BUS_DMA_COHERENT,
                                 &dd->dd_dmamap);
        if (error != 0) {
                if_printf(ifp, "unable to alloc memory for %u %s descriptors, "
@@ -3788,7 +3783,7 @@
                        /*
                         * If mbuf allocation failed previously there
                         * will be no mbuf; try again to re-populate it.
-                        */ 
+                        */
                        /* XXX make debug msg */
                        if_printf(ifp, "%s: no mbuf!\n", __func__);
                        STAILQ_REMOVE_HEAD(&sc->sc_rxbuf, bf_list);
@@ -3859,7 +3854,7 @@
                                        bus_dmamap_sync(sc->sc_dmat,
                                            bf->bf_dmamap,
                                            BUS_DMASYNC_POSTREAD);
-                                       ath_handle_micerror(ic, 
+                                       ath_handle_micerror(ic,
                                            mtod(m, struct ieee80211_frame *),
                                            sc->sc_splitmic ?
                                                rs->rs_keyix-32 : rs->rs_keyix);
@@ -4036,7 +4031,7 @@
                         */
                        if (type == IEEE80211_FC0_TYPE_DATA) {
                                const HAL_RATE_TABLE *rt = sc->sc_currates;
-                               ath_led_event(sc, 
+                               ath_led_event(sc,
                                    rt->rateCodeToIndex[rs->rs_rate]);
                        } else if (ticks - sc->sc_ledevent >= sc->sc_ledidle)
                                ath_led_event(sc, 0);
@@ -5318,7 +5313,7 @@
        return 0;
 }
 
-/* 
+/*
  * Update internal state after a channel change.
  */
 static void
@@ -5537,7 +5532,7 @@
                sc->sc_syncbeacon = 1;
 }
 
-/* 
+/*
  * Walk the vap list and check if there any vap's in RUN state.
  */
 static int
@@ -5799,7 +5794,7 @@
        an->an_mgmtrix = ath_tx_findrix(sc, tp->mgmtrate);
 
        ath_rate_newassoc(sc, an, isnew);
-       if (isnew && 
+       if (isnew &&
            (vap->iv_flags & IEEE80211_F_PRIVACY) == 0 && sc->sc_hasclrkey &&
            ni->ni_ucastkey.wk_keyix == IEEE80211_KEYIX_NONE)
                ath_setup_stationkey(ni);
@@ -6119,7 +6114,7 @@
                if (ath_hal_gethangstate(sc->sc_ah, 0xffff, &hangs) &&
                    hangs != 0) {
                        if_printf(ifp, "%s hang detected (0x%x)\n",
-                           hangs & 0xff ? "bb" : "mac", hangs); 
+                           hangs & 0xff ? "bb" : "mac", hangs);
                } else
                        if_printf(ifp, "device timeout\n");
                ath_reset(ifp);
@@ -6800,7 +6795,7 @@
        if (IFF_DUMPPKTS(sc, ATH_DEBUG_XMIT))
                ieee80211_dump_pkt(ic, mtod(m0, caddr_t), m0->m_len,
                    sc->sc_hwmap[rix].ieeerate, -1);
-       
+
        if (ieee80211_radiotap_active_vap(vap)) {
                u_int64_t tsf = ath_hal_gettsf64(ah);
 

Modified: 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_athvar.h
===================================================================
--- 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_athvar.h
 2009-12-29 18:15:39 UTC (rev 34810)
+++ 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_athvar.h
 2009-12-29 18:24:35 UTC (rev 34811)
@@ -306,7 +306,7 @@
        u_int                   sc_txqsetup;    /* h/w queues setup */
        u_int                   sc_txintrperiod;/* tx interrupt batching */
        struct ath_txq          sc_txq[HAL_NUM_TX_QUEUES];
-       struct ath_txq          *sc_ac2q[5];    /* WME AC -> h/w q map */ 
+       struct ath_txq          *sc_ac2q[5];    /* WME AC -> h/w q map */
        struct task             sc_txtask;      /* tx int processing */
        int                     sc_wd_timer;    /* count down for wd timer */
        struct callout          sc_wd_ch;       /* tx watchdog timer */
@@ -343,8 +343,8 @@
        u_int32_t               sc_avgtsfdeltap;/* TDMA slot adjust (+) */
        u_int32_t               sc_avgtsfdeltam;/* TDMA slot adjust (-) */
 
-#ifdef __HAIKU__
-       HAL_INT                 sc_lastisr;
+#if defined(__HAIKU__)
+       HAL_INT sc_intr_status;
 #endif
 };
 

Modified: haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi/glue.c
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi/glue.c      
2009-12-29 18:15:39 UTC (rev 34810)
+++ haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi/glue.c      
2009-12-29 18:24:35 UTC (rev 34811)
@@ -23,21 +23,18 @@
 int
 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
 {
-       struct ath_softc* ath = (struct ath_softc*)device_get_softc(dev);
-       struct ath_hal* ah = ath->sc_ah;
-       HAIKU_INTR_REGISTER_STATE;
+       struct ath_softc* sc = (struct ath_softc*)device_get_softc(dev);
+       struct ath_hal* ah = sc->sc_ah;
+       HAL_INT intr_status;
 
-       if (ath->sc_invalid)
+       if (sc->sc_invalid)
                // The hardware is not ready/present, don't touch anything.
                // Note this can happen early on if the IRQ is shared.
                return 0;
 
-       HAIKU_INTR_REGISTER_ENTER();
-       if (!ath_hal_intrpend(ah)) {
+       if (!ath_hal_intrpend(ah))
                // shared irq, not for us
-               HAIKU_INTR_REGISTER_LEAVE();
                return 0;
-       }
 
         // We have to save the isr status right now.
         // Some devices don't like having the interrupt disabled
@@ -48,12 +45,12 @@
         //
         // Note: Haiku's pcnet driver uses the same technique of
         //       appending a sc_lastisr field.
-       ath_hal_getisr(ah, &ath->sc_lastisr);
+       ath_hal_getisr(ah, &intr_status);
+       atomic_or((int32*)&sc->sc_intr_status, intr_status);
 
        ath_hal_intrset(ah, 0);
                // disable further intr's
 
-       HAIKU_INTR_REGISTER_LEAVE();
        return 1;
 }
 
@@ -61,8 +58,8 @@
 void
 HAIKU_REENABLE_INTERRUPTS(device_t dev)
 {
-       struct ath_softc* ath = (struct ath_softc*)device_get_softc(dev);
-       struct ath_hal* ah = ath->sc_ah;
+       struct ath_softc* sc = (struct ath_softc*)device_get_softc(dev);
+       struct ath_hal* ah = sc->sc_ah;
 
-       ath_hal_intrset(ah, ath->sc_imask);
+       ath_hal_intrset(ah, sc->sc_imask);
 }


Other related posts:

  • » [haiku-commits] r34811 - in haiku/trunk/src/add-ons/kernel/drivers/network/wlan/atheroswifi: . dev/ath - coling