p4-projects@freebsd.org
[Top] [All Lists]

PERFORCE change 114930 for review

Subject: PERFORCE change 114930 for review
From: Sam Leffler
Date: Fri, 23 Feb 2007 23:35:32 GMT
http://perforce.freebsd.org/chv.cgi?CH=114930

Change 114930 by sam@sam_ebb on 2007/02/23 23:34:40

        Cleanups:
        o nuke sc_half_rates and sc_quarter_rates; don't need 'em
        o fix type punning that gcc 4.x barfs on
        o kill trailing whitespace
        o remove redundant merge cruft
        
        and one fix:
        o properly reclaim tx frags on error
        Obtained from:  netbsd (tx frag reclaim fix)

Affected files ...

.. //depot/projects/wifi/sys/dev/ath/if_ath.c#134 edit
.. //depot/projects/wifi/sys/dev/ath/if_athvar.h#53 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ath/if_ath.c#134 (text+ko) ====

@@ -430,7 +430,7 @@
        if (!ath_tx_setup(sc, WME_AC_BE, HAL_WME_AC_BE) ||
            !ath_tx_setup(sc, WME_AC_VI, HAL_WME_AC_VI) ||
            !ath_tx_setup(sc, WME_AC_VO, HAL_WME_AC_VO)) {
-               /* 
+               /*
                 * Not enough hardware tx queues to properly do WME;
                 * just punt and assign them all to the same h/w queue.
                 * We could do a better job of this if, for example,
@@ -446,7 +446,7 @@
                sc->sc_ac2q[WME_AC_VO] = sc->sc_ac2q[WME_AC_BK];
        }
 
-       /* 
+       /*
         * Special case certain configurations.  Note the
         * CAB queue is handled by these specially so don't
         * include them when checking the txq setup mask.
@@ -883,6 +883,7 @@
        struct ifnet *ifp = sc->sc_ifp;
        u_int32_t *state;
        u_int32_t len;
+       void *sp;
 
        if_printf(ifp, "hardware error; resetting\n");
        /*
@@ -890,8 +891,9 @@
         * are caused by DMA errors.  Collect h/w state from
         * the hal so we can diagnose what's going on.
         */
-       if (ath_hal_getfatalstate(sc->sc_ah, &state, &len)) {
+       if (ath_hal_getfatalstate(sc->sc_ah, &sp, &len)) {
                KASSERT(len >= 6*sizeof(u_int32_t), ("len %u bytes", len));
+               state = sp;
                if_printf(ifp, "0x%08x 0x%08x 0x%08x, 0x%08x 0x%08x 0x%08x\n",
                    state[0], state[1] , state[2], state[3],
                    state[4], state[5]);
@@ -1182,14 +1184,14 @@
        sc->sc_diversity = ath_hal_getdiversity(ah);
        sc->sc_calinterval = 1;
        sc->sc_caltries = 0;
+       if (ath_startrecv(sc) != 0)     /* restart recv */
+               if_printf(ifp, "%s: unable to start recv logic\n", __func__);
        /*
         * We may be doing a reset in response to an ioctl
         * that changes the channel so update any state that
         * might change as a result.
         */
        ath_chan_change(sc, ic->ic_curchan);
-       if (ath_startrecv(sc) != 0)     /* restart recv */
-               if_printf(ifp, "%s: unable to start recv logic\n", __func__);
        if (ic->ic_state == IEEE80211_S_RUN)
                ath_beacon_config(sc);  /* restart beacons */
        ath_intrset(sc, sc->sc_imask);
@@ -1622,7 +1624,7 @@
                                break;
                        }
                        STAILQ_INIT(&frags);
-                       /* 
+                       /*
                         * Find the node for the destination so we can do
                         * things like power save and fast frames aggregation.
                         */
@@ -1702,7 +1704,7 @@
                                goto bad;
                        }
                        /*
-                        * Check for fragmentation.  If this has frame
+                        * Check for fragmentation.  If this frame
                         * has been broken up verify we have enough
                         * buffers to send all the fragments so all
                         * go out or none...
@@ -2924,7 +2926,7 @@
                if (bs.bs_sleepduration > bs.bs_dtimperiod)
                        bs.bs_sleepduration = roundup(bs.bs_sleepduration, 
bs.bs_dtimperiod);
 
-               DPRINTF(sc, ATH_DEBUG_BEACON, 
+               DPRINTF(sc, ATH_DEBUG_BEACON,
                        "%s: tsf %ju tsf:tu %u intval %u nexttbtt %u dtim %u 
nextdtim %u bmiss %u sleep %u cfp:period %u maxdur %u next %u timoffset %u\n"
                        , __func__
                        , tsf, tsftu
@@ -3510,7 +3512,7 @@
                                bf->bf_daddr, PA2DESC(sc, ds->ds_link), rs);
 #ifdef ATH_DEBUG
                if (sc->sc_debug & ATH_DEBUG_RECV_DESC)
-                       ath_printrxbuf(bf, 0, status == HAL_OK); 
+                       ath_printrxbuf(bf, 0, status == HAL_OK);
 #endif
                if (status == HAL_EINPROGRESS)
                        break;
@@ -3843,7 +3845,7 @@
        ath_hal_gettxqueueprops(ah, txq->axq_qnum, &qi);
        qi.tqi_aifs = wmep->wmep_aifsn;
        qi.tqi_cwmin = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmin);
-       qi.tqi_cwmax = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmax);      
+       qi.tqi_cwmax = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmax);
        qi.tqi_burstTime = ATH_TXOP_TO_US(wmep->wmep_txopLimit);
 
        if (!ath_hal_settxqueueprops(ah, txq->axq_qnum, &qi)) {
@@ -4032,7 +4034,7 @@
                bf->bf_nseg = ATH_TXDESC+1;
        } else if (error != 0) {
                sc->sc_stats.ast_tx_busdma++;
-               m_freem(m0);
+               ath_freetx(m0);
                return error;
        }
        /*
@@ -4044,7 +4046,7 @@
                sc->sc_stats.ast_tx_linear++;
                m = ath_defrag(m0, M_DONTWAIT, ATH_TXDESC);
                if (m == NULL) {
-                       m_freem(m0);
+                       ath_freetx(m0);
                        sc->sc_stats.ast_tx_nombuf++;
                        return ENOMEM;
                }
@@ -4054,14 +4056,14 @@
                                             BUS_DMA_NOWAIT);
                if (error != 0) {
                        sc->sc_stats.ast_tx_busdma++;
-                       m_freem(m0);
+                       ath_freetx(m0);
                        return error;
                }
                KASSERT(bf->bf_nseg <= ATH_TXDESC,
                    ("too many segments after defrag; nseg %u", bf->bf_nseg));
        } else if (bf->bf_nseg == 0) {          /* null packet, discard */
                sc->sc_stats.ast_tx_nodata++;
-               m_freem(m0);
+               ath_freetx(m0);
                return EIO;
        }
        DPRINTF(sc, ATH_DEBUG_XMIT, "%s: m %p len %u\n",
@@ -4498,7 +4500,7 @@
                        &sc->sc_tx_th, sc->sc_tx_th_len, m0);
        }
 
-       /* 
+       /*
         * Determine if a tx interrupt should be generated for
         * this descriptor.  We take a tx interrupt to reap
         * descriptors when the h/w hits an EOL condition or
@@ -5145,8 +5147,6 @@
                DPRINTF(sc, ATH_DEBUG_CALIBRATE,
                        "%s: rfgain change\n", __func__);
                sc->sc_stats.ast_per_rfgain++;
-               DPRINTF(sc, ATH_DEBUG_CALIBRATE,
-                       "%s: rfgain change\n", __func__);
                ath_reset(sc->sc_ifp);
        }
        if (!ath_hal_calibrate(ah, &sc->sc_curchan, &iqCalDone)) {
@@ -5155,10 +5155,13 @@
                        __func__, sc->sc_curchan.channel);
                sc->sc_stats.ast_per_calfail++;
        }
+       /*
+        * Calibrate noise floor data again in case of change.
+        */
        ath_hal_process_noisefloor(ah);
        /*
         * Poll more frequently when the IQ calibration is in
-        * progress to speedup loading the final settings. 
+        * progress to speedup loading the final settings.
         * We temper this aggressive polling with an exponential
         * back off after 4 tries up to ath_calinterval.
         */
@@ -5590,7 +5593,7 @@
                ath_hal_gettxpowlimit(ah, &txpow);
                ic->ic_txpowlimit = sc->sc_curtxpow = txpow;
        }
-       /* 
+       /*
         * Fetch max tx power level for status requests.
         */
        ath_hal_getmaxtxpow(sc->sc_ah, &txpow);
@@ -5885,8 +5888,6 @@
                sc->sc_stats.ast_rx_packets = ifp->if_ipackets;
                ieee80211_getsignal(ic, &sc->sc_stats.ast_rx_rssi,
                        &sc->sc_stats.ast_rx_noise);
-               sc->sc_stats.ast_rx_noise =
-                       ath_hal_getchannoise(sc->sc_ah, &sc->sc_curchan);
                sc->sc_stats.ast_tx_rate = sc->sc_hwmap[sc->sc_txrate].ieeerate;
                ATH_UNLOCK(sc);
                /*

==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#53 (text+ko) ====

@@ -230,8 +230,6 @@
 #define        IEEE80211_MODE_HALF     (IEEE80211_MODE_MAX+0)
 #define        IEEE80211_MODE_QUARTER  (IEEE80211_MODE_MAX+1)
        const HAL_RATE_TABLE    *sc_rates[IEEE80211_MODE_MAX+2];
-       const HAL_RATE_TABLE    *sc_half_rates; /* half rate table */
-       const HAL_RATE_TABLE    *sc_quarter_rates;/* quarter rate table */
        const HAL_RATE_TABLE    *sc_currates;   /* current rate table */
        enum ieee80211_phymode  sc_curmode;     /* current phy mode */
        HAL_OPMODE              sc_opmode;      /* current operating mode */
@@ -450,7 +448,7 @@
        ((*(_ah)->ah_getDiagState)((_ah), (_id), \
                (_indata), (_insize), (_outdata), (_outsize)))
 #define        ath_hal_getfatalstate(_ah, _outdata, _outsize) \
-       ath_hal_getdiagstate(_ah, 29, NULL, 0, (void **)(_outdata), _outsize)
+       ath_hal_getdiagstate(_ah, 29, NULL, 0, (_outdata), _outsize)
 #define        ath_hal_setuptxqueue(_ah, _type, _irq) \
        ((*(_ah)->ah_setupTxQueue)((_ah), (_type), (_irq)))
 #define        ath_hal_resettxqueue(_ah, _q) \
_______________________________________________
p4-projects@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/p4-projects
To unsubscribe, send any mail to "p4-projects-unsubscribe@xxxxxxxxxxx"

<Prev in Thread] Current Thread [Next in Thread>
  • PERFORCE change 114930 for review, Sam Leffler <=