Author: adrian
Date: Sat Jul 27 14:58:23 2013
New Revision: 253705
URL: http://svnweb.freebsd.org/changeset/base/253705

Log:
  Implement some function tracing.
  
  Submitted by: Cedric GROSS <c...@cgross.info>

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c   Sat Jul 27 09:00:32 2013        (r253704)
+++ head/sys/dev/iwn/if_iwn.c   Sat Jul 27 14:58:23 2013        (r253705)
@@ -339,6 +339,7 @@ enum {
        IWN_DEBUG_CMD           = 0x00001000,   /* cmd submission */
        IWN_DEBUG_TXRATE        = 0x00002000,   /* TX rate debugging */
        IWN_DEBUG_PWRSAVE       = 0x00004000,   /* Power save operations */
+       IWN_DEBUG_TRACE         = 0x40000000,   /* Print begin and start driver 
function */
        IWN_DEBUG_FATAL         = 0x80000000,   /* fatal errors */
        IWN_DEBUG_ANY           = 0xffffffff
 };
@@ -456,6 +457,8 @@ iwn_attach(device_t dev)
        sc->sc_debug = 0;
 #endif
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: begin\n",__func__);
+
        /*
         * Get the offset of the PCI Express Capability Structure in PCI
         * Configuration Space.
@@ -706,9 +709,11 @@ iwn_attach(device_t dev)
 
        if (bootverbose)
                ieee80211_announce(ic);
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
        return 0;
 fail:
        iwn_detach(dev);
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end in error\n",__func__);
        return error;
 }
 
@@ -717,6 +722,7 @@ iwn4965_attach(struct iwn_softc *sc, uin
 {
        struct iwn_ops *ops = &sc->ops;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
        ops->load_firmware = iwn4965_load_firmware;
        ops->read_eeprom = iwn4965_read_eeprom;
        ops->post_alive = iwn4965_post_alive;
@@ -747,6 +753,8 @@ iwn4965_attach(struct iwn_softc *sc, uin
        sc->txchainmask = IWN_ANT_AB;
        sc->rxchainmask = IWN_ANT_ABC;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "%s: end\n",__func__);
+
        return 0;
 }
 
@@ -755,6 +763,8 @@ iwn5000_attach(struct iwn_softc *sc, uin
 {
        struct iwn_ops *ops = &sc->ops;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        ops->load_firmware = iwn5000_load_firmware;
        ops->read_eeprom = iwn5000_read_eeprom;
        ops->post_alive = iwn5000_post_alive;
@@ -831,6 +841,7 @@ iwn5000_attach(struct iwn_softc *sc, uin
        default:
                device_printf(sc->sc_dev, "adapter type %d not supported\n",
                    sc->hw_type);
+               DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end in error\n",__func__);
                return ENOTSUP;
        }
        return 0;
@@ -844,12 +855,13 @@ iwn_radiotap_attach(struct iwn_softc *sc
 {
        struct ifnet *ifp = sc->sc_ifp;
        struct ieee80211com *ic = ifp->if_l2com;
-
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
        ieee80211_radiotap_attach(ic,
            &sc->sc_txtap.wt_ihdr, sizeof(sc->sc_txtap),
                IWN_TX_RADIOTAP_PRESENT,
            &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap),
                IWN_RX_RADIOTAP_PRESENT);
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end\n", __func__);
 }
 
 static void
@@ -949,6 +961,7 @@ iwn_detach(device_t dev)
        if (ifp != NULL)
                if_free(ifp);
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s done\n", __func__);
        IWN_LOCK_DESTROY(sc);
        return 0;
 }
@@ -1109,6 +1122,7 @@ iwn_eeprom_lock(struct iwn_softc *sc)
                        DELAY(10);
                }
        }
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end timeout\n", __func__);
        return ETIMEDOUT;
 }
 
@@ -1128,6 +1142,8 @@ iwn_init_otprom(struct iwn_softc *sc)
        uint16_t prev, base, next;
        int count, error;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Wait for clock stabilization before accessing prph. */
        if ((error = iwn_clock_wait(sc)) != 0)
                return error;
@@ -1171,6 +1187,9 @@ iwn_init_otprom(struct iwn_softc *sc)
                /* Skip "next" word. */
                sc->prom_base = prev + 1;
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end\n", __func__);
+
        return 0;
 }
 
@@ -1181,6 +1200,8 @@ iwn_read_prom_data(struct iwn_softc *sc,
        uint32_t val, tmp;
        int ntries;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        addr += sc->prom_base;
        for (; count > 0; count -= 2, addr++) {
                IWN_WRITE(sc, IWN_EEPROM, addr << 2);
@@ -1213,6 +1234,9 @@ iwn_read_prom_data(struct iwn_softc *sc,
                if (count > 1)
                        *out++ = val >> 24;
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end\n", __func__);
+
        return 0;
 }
 
@@ -1343,6 +1367,8 @@ iwn_alloc_rx_ring(struct iwn_softc *sc, 
 
        ring->cur = 0;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Allocate RX descriptors (256-byte aligned). */
        size = IWN_RX_RING_COUNT * sizeof (uint32_t);
        error = iwn_dma_contig_alloc(sc, &ring->desc_dma, (void **)&ring->desc,
@@ -1417,9 +1443,14 @@ iwn_alloc_rx_ring(struct iwn_softc *sc, 
        bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map,
            BUS_DMASYNC_PREWRITE);
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return 0;
 
 fail:  iwn_free_rx_ring(sc, ring);
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end in error\n",__func__);
+
        return error;
 }
 
@@ -1428,6 +1459,8 @@ iwn_reset_rx_ring(struct iwn_softc *sc, 
 {
        int ntries;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        if (iwn_nic_lock(sc) == 0) {
                IWN_WRITE(sc, IWN_FH_RX_CONFIG, 0);
                for (ntries = 0; ntries < 1000; ntries++) {
@@ -1447,6 +1480,8 @@ iwn_free_rx_ring(struct iwn_softc *sc, s
 {
        int i;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s \n", __func__);
+
        iwn_dma_contig_free(&ring->desc_dma);
        iwn_dma_contig_free(&ring->stat_dma);
 
@@ -1480,6 +1515,8 @@ iwn_alloc_tx_ring(struct iwn_softc *sc, 
        ring->queued = 0;
        ring->cur = 0;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Allocate TX descriptors (256-byte aligned). */
        size = IWN_TX_RING_COUNT * sizeof (struct iwn_tx_desc);
        error = iwn_dma_contig_alloc(sc, &ring->desc_dma, (void **)&ring->desc,
@@ -1528,9 +1565,13 @@ iwn_alloc_tx_ring(struct iwn_softc *sc, 
                        goto fail;
                }
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end\n", __func__);
+
        return 0;
 
 fail:  iwn_free_tx_ring(sc, ring);
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end in error\n", __func__);
        return error;
 }
 
@@ -1539,6 +1580,8 @@ iwn_reset_tx_ring(struct iwn_softc *sc, 
 {
        int i;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->doing %s \n", __func__);
+
        for (i = 0; i < IWN_TX_RING_COUNT; i++) {
                struct iwn_tx_data *data = &ring->data[i];
 
@@ -1564,6 +1607,8 @@ iwn_free_tx_ring(struct iwn_softc *sc, s
 {
        int i;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s \n", __func__);
+
        iwn_dma_contig_free(&ring->desc_dma);
        iwn_dma_contig_free(&ring->cmd_dma);
 
@@ -1617,6 +1662,8 @@ iwn_read_eeprom(struct iwn_softc *sc, ui
        uint16_t val;
        int error;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Check whether adapter has an EEPROM or an OTPROM. */
        if (sc->hw_type >= IWN_HW_REV_TYPE_1000 &&
            (IWN_READ(sc, IWN_OTP_GP) & IWN_OTP_GP_DEV_SEL_OTP))
@@ -1674,6 +1721,9 @@ iwn_read_eeprom(struct iwn_softc *sc, ui
        iwn_apm_stop(sc);       /* Power OFF adapter. */
 
        iwn_eeprom_unlock(sc);
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end\n", __func__);
+
        return 0;
 }
 
@@ -1684,6 +1734,8 @@ iwn4965_read_eeprom(struct iwn_softc *sc
        uint16_t val;
        int i;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Read regulatory domain (4 ASCII characters). */
        iwn_read_prom_data(sc, IWN4965_EEPROM_DOMAIN, sc->eeprom_domain, 4);
 
@@ -1722,6 +1774,8 @@ iwn4965_read_eeprom(struct iwn_softc *sc
                        iwn4965_print_power_group(sc, i);
        }
 #endif
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end\n", __func__);
 }
 
 #ifdef IWN_DEBUG
@@ -1768,6 +1822,8 @@ iwn5000_read_eeprom(struct iwn_softc *sc
        uint16_t val;
        int i;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Read regulatory domain (4 ASCII characters). */
        iwn_read_prom_data(sc, IWN5000_EEPROM_REG, &val, 2);
        base = le16toh(val);
@@ -1811,6 +1867,9 @@ iwn5000_read_eeprom(struct iwn_softc *sc
                DPRINTF(sc, IWN_DEBUG_CALIBRATE, "crystal calibration 0x%08x\n",
                    le32toh(sc->eeprom_crystal));
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end\n", __func__);
+
 }
 
 /*
@@ -1846,6 +1905,8 @@ iwn_read_eeprom_band(struct iwn_softc *s
        uint8_t chan;
        int i, nflags;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        for (i = 0; i < band->nchan; i++) {
                if (!(channels[i].flags & IWN_EEPROM_CHAN_VALID)) {
                        DPRINTF(sc, IWN_DEBUG_RESET,
@@ -1888,6 +1949,9 @@ iwn_read_eeprom_band(struct iwn_softc *s
                        c->ic_flags |= IEEE80211_CHAN_HT20;
                }
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end\n", __func__);
+
 }
 
 static void
@@ -1901,8 +1965,12 @@ iwn_read_eeprom_ht40(struct iwn_softc *s
        uint8_t chan;
        int i, nflags;
 
-       if (!(sc->sc_flags & IWN_FLAG_HAS_11N))
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s start\n", __func__);
+
+       if (!(sc->sc_flags & IWN_FLAG_HAS_11N)) {
+               DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end no 11n\n", __func__);
                return;
+       }
 
        for (i = 0; i < band->nchan; i++) {
                if (!(channels[i].flags & IWN_EEPROM_CHAN_VALID)) {
@@ -1950,6 +2018,9 @@ iwn_read_eeprom_ht40(struct iwn_softc *s
                c->ic_flags &= ~IEEE80211_CHAN_HT;
                c->ic_flags |= IEEE80211_CHAN_HT40D | nflags;
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end\n", __func__);
+
 }
 
 static void
@@ -2033,6 +2104,8 @@ iwn_read_eeprom_enhinfo(struct iwn_softc
        uint8_t flags;
        int i, j;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        iwn_read_prom_data(sc, IWN5000_EEPROM_REG, &val, 2);
        base = le16toh(val);
        iwn_read_prom_data(sc, base + IWN6000_EEPROM_ENHINFO,
@@ -2083,6 +2156,9 @@ iwn_read_eeprom_enhinfo(struct iwn_softc
                        c->ic_maxpower = maxpwr;
                }
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end\n", __func__);
+
 }
 
 static struct ieee80211_node *
@@ -2229,6 +2305,8 @@ iwn_newstate(struct ieee80211vap *vap, e
        struct iwn_softc *sc = ic->ic_ifp->if_softc;
        int error = 0;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        DPRINTF(sc, IWN_DEBUG_STATE, "%s: %s -> %s\n", __func__,
            ieee80211_state_name[vap->iv_state], ieee80211_state_name[nstate]);
 
@@ -2288,8 +2366,13 @@ iwn_newstate(struct ieee80211vap *vap, e
        }
        IWN_UNLOCK(sc);
        IEEE80211_LOCK(ic);
-       if (error != 0)
+       if (error != 0){
+               DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end in error\n", __func__);
                return error;
+       }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return ivp->iv_newstate(vap, nstate, arg);
 }
 
@@ -2353,6 +2436,8 @@ iwn_rx_done(struct iwn_softc *sc, struct
        uint32_t flags;
        int error, len, rssi, nf;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        if (desc->type == IWN_MPDU_RX_DONE) {
                /* Check for prior RX_PHY notification. */
                if (!sc->last_rx_valid) {
@@ -2491,6 +2576,9 @@ iwn_rx_done(struct iwn_softc *sc, struct
                (void)ieee80211_input_all(ic, m, rssi - nf, nf);
 
        IWN_LOCK(sc);
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
 }
 
 /* Process an incoming Compressed BlockAck. */
@@ -2512,6 +2600,8 @@ iwn_rx_compressed_ba(struct iwn_softc *s
        uint8_t tid;
        int ackfailcnt = 0, i, lastidx, qid, *res, shift;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD);
 
        qid = le16toh(ba->qid);
@@ -2583,6 +2673,9 @@ iwn_rx_compressed_ba(struct iwn_softc *s
                }
                bitmap >>= 1;
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
 }
 
 /*
@@ -2596,10 +2689,14 @@ iwn5000_rx_calib_results(struct iwn_soft
        struct iwn_phy_calib *calib = (struct iwn_phy_calib *)(desc + 1);
        int len, idx = -1;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Runtime firmware should not send such a notification. */
-       if (sc->sc_flags & IWN_FLAG_CALIB_DONE)
+       if (sc->sc_flags & IWN_FLAG_CALIB_DONE){
+               DPRINTF(sc, IWN_DEBUG_TRACE, "->%s received after clib done\n",
+           __func__);
                return;
-
+       }
        len = (le32toh(desc->len) & 0x3fff) - 4;
        bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD);
 
@@ -2661,10 +2758,15 @@ iwn_rx_statistics(struct iwn_softc *sc, 
        struct iwn_stats *stats = (struct iwn_stats *)(desc + 1);
        int temp;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Ignore statistics received during a scan. */
        if (vap->iv_state != IEEE80211_S_RUN ||
-           (ic->ic_flags & IEEE80211_F_SCAN))
+           (ic->ic_flags & IEEE80211_F_SCAN)){
+               DPRINTF(sc, IWN_DEBUG_TRACE, "->%s received during calib\n",
+           __func__);
                return;
+       }
 
        bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD);
 
@@ -2702,6 +2804,8 @@ iwn_rx_statistics(struct iwn_softc *sc, 
                iwn_collect_noise(sc, &stats->rx.general);
        else if (calib->state == IWN_CALIB_STATE_RUN)
                iwn_tune_sensitivity(sc, &stats->rx);
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
 }
 
 /*
@@ -2783,6 +2887,8 @@ iwn_tx_done(struct iwn_softc *sc, struct
 
        KASSERT(data->ni != NULL, ("no node"));
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Unmap and free mbuf. */
        bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTWRITE);
        bus_dmamap_unload(ring->data_dmat, data->map);
@@ -2837,6 +2943,9 @@ iwn_tx_done(struct iwn_softc *sc, struct
                        iwn_start_locked(ifp);
                }
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
 }
 
 /*
@@ -2884,6 +2993,8 @@ iwn_ampdu_tx_done(struct iwn_softc *sc, 
        uint8_t tid;
        int bit, i, lastidx, *res, seqno, shift, start;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
 #ifdef NOT_YET
        if (nframes == 1) {
                if ((*status & 0xff) != 1 && (*status & 0xff) != 2)
@@ -2970,6 +3081,9 @@ iwn_ampdu_tx_done(struct iwn_softc *sc, 
                        iwn_start_locked(ifp);
                }
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
 }
 
 /*
@@ -3280,7 +3394,8 @@ iwn_intr(void *arg)
                r2 = IWN_READ(sc, IWN_FH_INT);
        }
 
-       DPRINTF(sc, IWN_DEBUG_INTR, "interrupt reg1=%x reg2=%x\n", r1, r2);
+       DPRINTF(sc, IWN_DEBUG_INTR, "interrupt reg1=0x%08x reg2=0x%08x\n"
+    , r1, r2);
 
        if (r1 == 0 && r2 == 0)
                goto done;      /* Interrupt not for us. */
@@ -3353,6 +3468,8 @@ iwn4965_update_sched(struct iwn_softc *s
 {
        uint16_t *w = &sc->sched[qid * IWN4965_SCHED_COUNT + idx];
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        *w = htole16(len + 8);
        bus_dmamap_sync(sc->sched_dma.tag, sc->sched_dma.map,
            BUS_DMASYNC_PREWRITE);
@@ -3369,6 +3486,8 @@ iwn5000_update_sched(struct iwn_softc *s
 {
        uint16_t *w = &sc->sched[qid * IWN5000_SCHED_COUNT + idx];
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        *w = htole16(id << 12 | (len + 8));
        bus_dmamap_sync(sc->sched_dma.tag, sc->sched_dma.map,
            BUS_DMASYNC_PREWRITE);
@@ -3385,6 +3504,8 @@ iwn5000_reset_sched(struct iwn_softc *sc
 {
        uint16_t *w = &sc->sched[qid * IWN5000_SCHED_COUNT + idx];
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        *w = (*w & htole16(0xf000)) | htole16(1);
        bus_dmamap_sync(sc->sched_dma.tag, sc->sched_dma.map,
            BUS_DMASYNC_PREWRITE);
@@ -3419,6 +3540,8 @@ iwn_tx_data(struct iwn_softc *sc, struct
        uint8_t tid, ridx, txant, type;
        int ac, i, totlen, error, pad, nsegs = 0, rate;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        IWN_LOCK_ASSERT(sc);
 
        wh = mtod(m, struct ieee80211_frame *);
@@ -3664,6 +3787,8 @@ iwn_tx_data(struct iwn_softc *sc, struct
        if (++ring->queued > IWN_TX_RING_HIMARK)
                sc->qfullmsk |= 1 << ring->qid;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return 0;
 }
 
@@ -3688,6 +3813,8 @@ iwn_tx_data_raw(struct iwn_softc *sc, st
        int ac, totlen, error, pad, nsegs = 0, i, rate;
        uint8_t ridx, type, txant;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        IWN_LOCK_ASSERT(sc);
 
        wh = mtod(m, struct ieee80211_frame *);
@@ -3873,6 +4000,8 @@ iwn_tx_data_raw(struct iwn_softc *sc, st
        if (++ring->queued > IWN_TX_RING_HIMARK)
                sc->qfullmsk |= 1 << ring->qid;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return 0;
 }
 
@@ -3885,6 +4014,8 @@ iwn_raw_xmit(struct ieee80211_node *ni, 
        struct iwn_softc *sc = ifp->if_softc;
        int error = 0;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
                ieee80211_free_node(ni);
                m_freem(m);
@@ -3913,6 +4044,9 @@ iwn_raw_xmit(struct ieee80211_node *ni, 
        sc->sc_tx_timer = 5;
 
        IWN_UNLOCK(sc);
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return error;
 }
 
@@ -3968,6 +4102,8 @@ iwn_watchdog(void *arg)
 
        KASSERT(ifp->if_drv_flags & IFF_DRV_RUNNING, ("not running"));
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        if (sc->sc_tx_timer > 0) {
                if (--sc->sc_tx_timer == 0) {
                        if_printf(ifp, "device timeout\n");
@@ -4035,6 +4171,8 @@ iwn_cmd(struct iwn_softc *sc, int code, 
        bus_addr_t paddr;
        int totlen, error;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        if (async == 0)
                IWN_LOCK_ASSERT(sc);
 
@@ -4090,6 +4228,8 @@ iwn_cmd(struct iwn_softc *sc, int code, 
        ring->cur = (ring->cur + 1) % IWN_TX_RING_COUNT;
        IWN_WRITE(sc, IWN_HBUS_TARG_WRPTR, ring->qid << 8 | ring->cur);
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return async ? 0 : msleep(desc, &sc->sc_mtx, PCATCH, "iwncmd", hz);
 }
 
@@ -4099,6 +4239,8 @@ iwn4965_add_node(struct iwn_softc *sc, s
        struct iwn4965_node_info hnode;
        caddr_t src, dst;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /*
         * We use the node structure for 5000 Series internally (it is
         * a superset of the one for 4965AGN). We thus copy the common
@@ -4115,6 +4257,9 @@ iwn4965_add_node(struct iwn_softc *sc, s
 static int
 iwn5000_add_node(struct iwn_softc *sc, struct iwn_node_info *node, int async)
 {
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /* Direct mapping. */
        return iwn_cmd(sc, IWN_CMD_ADD_NODE, node, sizeof (*node), async);
 }
@@ -4129,6 +4274,8 @@ iwn_set_link_quality(struct iwn_softc *s
        uint8_t txant;
        int i, rate, txrate;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Use the first valid TX antenna. */
        txant = IWN_LSB(sc->txchainmask);
 
@@ -4166,6 +4313,9 @@ iwn_set_link_quality(struct iwn_softc *s
                if (txrate > 0)
                        txrate--;
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return iwn_cmd(sc, IWN_CMD_LINK_QUALITY, &linkq, sizeof linkq, 1);
 #undef RV
 }
@@ -4184,6 +4334,8 @@ iwn_add_broadcast_node(struct iwn_softc 
        uint8_t txant;
        int i, error;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        memset(&node, 0, sizeof node);
        IEEE80211_ADDR_COPY(node.macaddr, ifp->if_broadcastaddr);
        node.id = sc->broadcast_id;
@@ -4212,6 +4364,9 @@ iwn_add_broadcast_node(struct iwn_softc 
        for (i = 1; i < IWN_MAX_TX_RETRIES; i++) {
                linkq.retry[i] = linkq.retry[0];
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return iwn_cmd(sc, IWN_CMD_LINK_QUALITY, &linkq, sizeof linkq, async);
 }
 
@@ -4223,6 +4378,8 @@ iwn_updateedca(struct ieee80211com *ic)
        struct iwn_edca_params cmd;
        int aci;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        memset(&cmd, 0, sizeof cmd);
        cmd.flags = htole32(IWN_EDCA_UPDATE);
        for (aci = 0; aci < WME_NUM_AC; aci++) {
@@ -4239,6 +4396,9 @@ iwn_updateedca(struct ieee80211com *ic)
        (void)iwn_cmd(sc, IWN_CMD_EDCA_PARAMS, &cmd, sizeof cmd, 1);
        IWN_UNLOCK(sc);
        IEEE80211_LOCK(ic);
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return 0;
 #undef IWN_EXP2
 }
@@ -4254,6 +4414,8 @@ iwn_set_led(struct iwn_softc *sc, uint8_
 {
        struct iwn_cmd_led led;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /* Clear microcode LED ownership. */
        IWN_CLRBITS(sc, IWN_LED, IWN_LED_BSM_CTRL);
 
@@ -4274,6 +4436,8 @@ iwn_set_critical_temp(struct iwn_softc *
        struct iwn_critical_temp crit;
        int32_t temp;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        IWN_WRITE(sc, IWN_UCODE_GP1_CLR, IWN_UCODE_GP1_CTEMP_STOP_RF);
 
        if (sc->hw_type == IWN_HW_REV_TYPE_5150)
@@ -4294,6 +4458,8 @@ iwn_set_timing(struct iwn_softc *sc, str
        struct iwn_cmd_timing cmd;
        uint64_t val, mod;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        memset(&cmd, 0, sizeof cmd);
        memcpy(&cmd.tstamp, ni->ni_tstamp.data, sizeof (uint64_t));
        cmd.bintval = htole16(ni->ni_intval);
@@ -4316,6 +4482,8 @@ iwn4965_power_calibration(struct iwn_sof
        struct ifnet *ifp = sc->sc_ifp;
        struct ieee80211com *ic = ifp->if_l2com;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /* Adjust TX power if need be (delta >= 3 degC). */
        DPRINTF(sc, IWN_DEBUG_CALIBRATE, "%s: temperature %d->%d\n",
            __func__, sc->temp, temp);
@@ -4487,6 +4655,8 @@ iwn5000_set_txpower(struct iwn_softc *sc
 {
        struct iwn5000_cmd_txpower cmd;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /*
         * TX power calibration is handled automatically by the firmware
         * for 5000 Series.
@@ -4509,6 +4679,8 @@ iwn4965_get_rssi(struct iwn_softc *sc, s
        uint8_t mask, agc;
        int rssi;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        mask = (le16toh(phy->antenna) >> 4) & IWN_ANT_ABC;
        agc  = (le16toh(phy->agc) >> 7) & 0x7f;
 
@@ -4534,6 +4706,8 @@ iwn5000_get_rssi(struct iwn_softc *sc, s
        uint8_t agc;
        int rssi;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        agc = (le32toh(phy->agc) >> 9) & 0x7f;
 
        rssi = MAX(le16toh(phy->rssi[0]) & 0xff,
@@ -4575,6 +4749,8 @@ iwn4965_get_temperature(struct iwn_softc
        struct iwn_ucode_info *uc = &sc->ucode_info;
        int32_t r1, r2, r3, r4, temp;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        r1 = le32toh(uc->temp[0].chan20MHz);
        r2 = le32toh(uc->temp[1].chan20MHz);
        r3 = le32toh(uc->temp[2].chan20MHz);
@@ -4599,6 +4775,8 @@ iwn5000_get_temperature(struct iwn_softc
 {
        int32_t temp;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /*
         * Temperature is not used by the driver for 5000 Series because
         * TX power calibration is handled by firmware.
@@ -4622,6 +4800,8 @@ iwn_init_sensitivity(struct iwn_softc *s
        uint32_t flags;
        int error;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /* Reset calibration state machine. */
        memset(calib, 0, sizeof (*calib));
        calib->state = IWN_CALIB_STATE_INIT;
@@ -4666,6 +4846,8 @@ iwn_collect_noise(struct iwn_softc *sc,
        uint32_t val;
        int i;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Accumulate RSSI and noise for all 3 antennas. */
        for (i = 0; i < 3; i++) {
                calib->rssi[i] += le32toh(stats->rssi[i]) & 0xff;
@@ -4704,6 +4886,9 @@ iwn_collect_noise(struct iwn_softc *sc,
        /* Enable power-saving mode if requested by user. */
        if (ic->ic_flags & IEEE80211_F_PMGTON)
                (void)iwn_set_pslevel(sc, 0, 3, 1);
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
 }
 
 static int
@@ -4711,6 +4896,8 @@ iwn4965_init_gains(struct iwn_softc *sc)
 {
        struct iwn_phy_calib_gain cmd;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        memset(&cmd, 0, sizeof cmd);
        cmd.code = IWN4965_PHY_CALIB_DIFF_GAIN;
        /* Differential gains initially set to 0 for all 3 antennas. */
@@ -4724,6 +4911,8 @@ iwn5000_init_gains(struct iwn_softc *sc)
 {
        struct iwn_phy_calib cmd;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        memset(&cmd, 0, sizeof cmd);
        cmd.code = sc->reset_noise_gain;
        cmd.ngroups = 1;
@@ -4740,6 +4929,8 @@ iwn4965_set_gains(struct iwn_softc *sc)
        struct iwn_phy_calib_gain cmd;
        int i, delta, noise;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /* Get minimal noise among connected antennas. */
        noise = INT_MAX;        /* NB: There's at least one antenna. */
        for (i = 0; i < 3; i++)
@@ -4773,6 +4964,8 @@ iwn5000_set_gains(struct iwn_softc *sc)
        struct iwn_phy_calib_gain cmd;
        int i, ant, div, delta;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /* We collected 20 beacons and !=6050 need a 1.5 factor. */
        div = (sc->hw_type == IWN_HW_REV_TYPE_6050) ? 20 : 30;
 
@@ -4831,9 +5024,13 @@ iwn_tune_sensitivity(struct iwn_softc *s
        uint8_t noise[3], noise_ref;
        int i, needs_update = 0;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Check that we've been enabled long enough. */
-       if ((rxena = le32toh(stats->general.load)) == 0)
+       if ((rxena = le32toh(stats->general.load)) == 0){
+               DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end not so long\n", 
__func__);
                return;
+       }
 
        /* Compute number of false alarms since last call for OFDM. */
        fa  = le32toh(stats->ofdm.bad_plcp) - calib->bad_plcp_ofdm;
@@ -4951,6 +5148,9 @@ iwn_tune_sensitivity(struct iwn_softc *s
 
        if (needs_update)
                (void)iwn_send_sensitivity(sc);
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
 #undef dec
 #undef inc
 }
@@ -5158,6 +5358,8 @@ iwn_config(struct iwn_softc *sc)
        uint16_t rxchain;
        int error;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        if (sc->hw_type == IWN_HW_REV_TYPE_6005) {
                /* Set radio temperature sensor offset. */
                error = iwn5000_temp_offset_calib(sc);
@@ -5271,6 +5473,9 @@ iwn_config(struct iwn_softc *sc)
                    "%s: could not set power saving level\n", __func__);
                return error;
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return 0;
 }
 
@@ -5305,6 +5510,8 @@ iwn_scan(struct iwn_softc *sc)
        uint8_t txant;
        int buflen, error;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        buf = malloc(IWN_SCAN_MAXSZ, M_DEVBUF, M_NOWAIT | M_ZERO);
        if (buf == NULL) {
                device_printf(sc->sc_dev,
@@ -5440,6 +5647,9 @@ iwn_scan(struct iwn_softc *sc)
            hdr->nchan);
        error = iwn_cmd(sc, IWN_CMD_SCAN, buf, buflen, 1);
        free(buf, M_DEVBUF);
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return error;
 }
 
@@ -5452,6 +5662,8 @@ iwn_auth(struct iwn_softc *sc, struct ie
        struct ieee80211_node *ni = vap->iv_bss;
        int error;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        /* Update adapter configuration. */
        IEEE80211_ADDR_COPY(sc->rxon.bssid, ni->ni_bssid);
        sc->rxon.chan = ieee80211_chan2ieee(ic, ni->ni_chan);
@@ -5499,6 +5711,9 @@ iwn_auth(struct iwn_softc *sc, struct ie
                    error);
                return error;
        }
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return 0;
 }
 
@@ -5513,6 +5728,8 @@ iwn_run(struct iwn_softc *sc, struct iee
        uint32_t htflags = 0;
        int error;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+
        if (ic->ic_opmode == IEEE80211_M_MONITOR) {
                /* Link LED blinks while monitoring. */
                iwn_set_led(sc, IWN_LED_LINK, 5, 5);
@@ -5632,6 +5849,9 @@ iwn_run(struct iwn_softc *sc, struct iee
 
        /* Link LED always on while associated. */
        iwn_set_led(sc, IWN_LED_LINK, 0, 1);
+
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
        return 0;
 }
 
@@ -5652,6 +5872,8 @@ iwn_ampdu_rx_start(struct ieee80211_node
        uint8_t tid;
        int error;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        tid = MS(le16toh(baparamset), IEEE80211_BAPS_TID);
        ssn = MS(le16toh(baseqctl), IEEE80211_BASEQ_START);
 
@@ -5684,6 +5906,8 @@ iwn_ampdu_rx_stop(struct ieee80211_node 
        struct iwn_node_info node;
        uint8_t tid;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /* XXX: tid as an argument */
        for (tid = 0; tid < WME_NUM_TID; tid++) {
                if (&ni->ni_rx_ampdu[tid] == rap)
@@ -5707,6 +5931,8 @@ iwn_addba_request(struct ieee80211_node 
        struct iwn_softc *sc = ni->ni_ic->ic_ifp->if_softc;
        int qid;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        for (qid = sc->firstaggqueue; qid < sc->ntxqs; qid++) {
                if (sc->qid2tap[qid] == NULL)
                        break;
@@ -5737,6 +5963,8 @@ iwn_addba_response(struct ieee80211_node
        uint8_t tid = tap->txa_tid;
        int ret;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        if (code == IEEE80211_STATUS_SUCCESS) {
                ni->ni_txseqs[tid] = tap->txa_start & 0xfff;
                ret = iwn_ampdu_tx_start(ni->ni_ic, ni, tid);
@@ -5765,6 +5993,8 @@ iwn_ampdu_tx_start(struct ieee80211com *
        struct iwn_node_info node;
        int error, qid;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /* Enable TX for the specified RA/TID. */
        wn->disable_tid &= ~(1 << tid);
        memset(&node, 0, sizeof node);
@@ -5796,6 +6026,8 @@ iwn_ampdu_tx_stop(struct ieee80211_node 
        uint8_t tid = tap->txa_tid;
        int qid;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        sc->sc_addba_stop(ni, tap);
 
        if (tap->txa_private == NULL)
@@ -5819,6 +6051,8 @@ iwn4965_ampdu_tx_start(struct iwn_softc 
 {
        struct iwn_node *wn = (void *)ni;
 
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /* Stop TX scheduler while we're changing its configuration. */
        iwn_prph_write(sc, IWN4965_SCHED_QUEUE_STATUS(qid),
            IWN4965_TXQ_STATUS_CHGACT);
@@ -5854,6 +6088,8 @@ iwn4965_ampdu_tx_start(struct iwn_softc 
 static void
 iwn4965_ampdu_tx_stop(struct iwn_softc *sc, int qid, uint8_t tid, uint16_t ssn)
 {
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        /* Stop TX scheduler while we're changing its configuration. */
        iwn_prph_write(sc, IWN4965_SCHED_QUEUE_STATUS(qid),
            IWN4965_TXQ_STATUS_CHGACT);
@@ -5874,6 +6110,8 @@ static void
 iwn5000_ampdu_tx_start(struct iwn_softc *sc, struct ieee80211_node *ni,
     int qid, uint8_t tid, uint16_t ssn)
 {
+       DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__);
+
        struct iwn_node *wn = (void *)ni;
 
        /* Stop TX scheduler while we're changing its configuration. */

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to