static SYSCTL_NODE(_hw_usb, OID_AUTO, run, CTLFLAG_RW, 0, "USB run");
SYSCTL_INT(_hw_usb_run, OID_AUTO, debug, CTLFLAG_RWTUN, &run_debug, 0,
"run debug level");
+
+enum {
+ RUN_DEBUG_XMIT = 0x00000001, /* basic xmit operation */
+ RUN_DEBUG_XMIT_DESC = 0x00000002, /* xmit descriptors */
+ RUN_DEBUG_RECV = 0x00000004, /* basic recv operation */
+ RUN_DEBUG_RECV_DESC = 0x00000008, /* recv descriptors */
+ RUN_DEBUG_STATE = 0x00000010, /* 802.11 state transitions */
+ RUN_DEBUG_RATE = 0x00000020, /* rate adaptation */
+ RUN_DEBUG_USB = 0x00000040, /* usb requests */
+ RUN_DEBUG_FIRMWARE = 0x00000080, /* firmware(9) loading debug */
+ RUN_DEBUG_BEACON = 0x00000100, /* beacon handling */
+ RUN_DEBUG_INTR = 0x00000200, /* ISR */
+ RUN_DEBUG_TEMP = 0x00000400, /* temperature calibration */
+ RUN_DEBUG_ROM = 0x00000800, /* various ROM info */
+ RUN_DEBUG_KEY = 0x00001000, /* crypto keys management */
+ RUN_DEBUG_TXPWR = 0x00002000, /* dump Tx power values */
+ RUN_DEBUG_RSSI = 0x00004000, /* dump RSSI lookups */
+ RUN_DEBUG_RESET = 0x00008000, /* initialization progress */
+ RUN_DEBUG_CALIB = 0x00010000, /* calibration progress */
+ RUN_DEBUG_CMD = 0x00010000, /* command queue */
+ RUN_DEBUG_ANY = 0xffffffff
+};
+
+#define RUN_DPRINTF(_sc, _m, ...) do { \
+ if (run_debug & (_m)) \
+ device_printf((_sc)->sc_dev, __VA_ARGS__); \
+} while(0)
+#else
+#define RUN_DPRINTF(_sc, _m, ...) do { (void) _sc; } while (0)
#endif
#define IEEE80211_HAS_ADDR4(wh) IEEE80211_IS_DSTODS(wh)
if (opmode == IEEE80211_M_HOSTAP)
sc->cmdq_run = RUN_CMDQ_GO;
- DPRINTF("rvp_id=%d bmap=%x rvp_cnt=%d\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_STATE, "rvp_id=%d bmap=%x rvp_cnt=%d\n",
rvp->rvp_id, sc->rvp_bmap, sc->rvp_cnt);
return (vap);
run_set_region_4(sc, RT2860_BCN_BASE(rvp_id), 0, 512);
--sc->rvp_cnt;
- DPRINTF("vap=%p rvp_id=%d bmap=%x rvp_cnt=%d\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_STATE,
+ "vap=%p rvp_id=%d bmap=%x rvp_cnt=%d\n",
vap, rvp_id, sc->rvp_bmap, sc->rvp_cnt);
RUN_UNLOCK(sc);
RUN_LOCK(sc);
for (i = sc->cmdq_exec; sc->cmdq[i].func && pending;
i = sc->cmdq_exec, pending--) {
- DPRINTFN(6, "cmdq_exec=%d pending=%d\n", i, pending);
+ RUN_DPRINTF(sc, RUN_DEBUG_CMD, "cmdq_exec=%d pending=%d\n",
+ i, pending);
if (sc->cmdq_run == RUN_CMDQ_GO) {
/*
* If arg0 is NULL, callback func needs more
req, data, 0, NULL, 250 /* ms */);
if (err == 0)
break;
- DPRINTFN(1, "Control request failed, %s (retrying)\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_USB,
+ "Control request failed, %s (retrying)\n",
usbd_errstr(err));
run_delay(sc, 10);
}
if (sc->txpow2[i] < 0 || sc->txpow2[i] > 31)
sc->txpow2[i] = 5;
}
- DPRINTF("chan %d: power1=%d, power2=%d\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_TXPWR,
+ "chan %d: power1=%d, power2=%d\n",
rt2860_rf2850[i].chan, sc->txpow1[i], sc->txpow2[i]);
}
/* Read power settings for 5GHz channels. */
if (sc->txpow2[14 + i] < -7 || sc->txpow2[14 + i] > 15)
sc->txpow2[14 + i] = 5;
}
- DPRINTF("chan %d: power1=%d, power2=%d\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_TXPWR,
+ "chan %d: power1=%d, power2=%d\n",
rt2860_rf2850[14 + i].chan, sc->txpow1[14 + i],
sc->txpow2[14 + i]);
}
sc->sc_srom_read = run_eeprom_read_2;
if (sc->mac_ver >= 0x3070) {
run_read(sc, RT3070_EFUSE_CTRL, &tmp);
- DPRINTF("EFUSE_CTRL=0x%08x\n", tmp);
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM, "EFUSE_CTRL=0x%08x\n", tmp);
if ((tmp & RT3070_SEL_EFUSE) || sc->mac_ver == 0x3593)
sc->sc_srom_read = run_efuse_read_2;
}
/* read ROM version */
run_srom_read(sc, RT2860_EEPROM_VERSION, &val);
- DPRINTF("EEPROM rev=%d, FAE=%d\n", val >> 8, val & 0xff);
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM,
+ "EEPROM rev=%d, FAE=%d\n", val >> 8, val & 0xff);
/* read MAC address */
run_srom_read(sc, RT2860_EEPROM_MAC01, &val);
run_srom_read(sc, RT2860_EEPROM_BBP_BASE + i, &val);
sc->bbp[i].val = val & 0xff;
sc->bbp[i].reg = val >> 8;
- DPRINTF("BBP%d=0x%02x\n", sc->bbp[i].reg,
- sc->bbp[i].val);
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM,
+ "BBP%d=0x%02x\n", sc->bbp[i].reg, sc->bbp[i].val);
}
if (sc->mac_ver >= 0x3071) {
/* read vendor RF settings */
&val);
sc->rf[i].val = val & 0xff;
sc->rf[i].reg = val >> 8;
- DPRINTF("RF%d=0x%02x\n", sc->rf[i].reg,
- sc->rf[i].val);
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM, "RF%d=0x%02x\n",
+ sc->rf[i].reg, sc->rf[i].val);
}
}
}
run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_FREQ_LEDS :
RT3593_EEPROM_FREQ, &val);
sc->freq = ((val & 0xff) != 0xff) ? val & 0xff : 0;
- DPRINTF("EEPROM freq offset %d\n", sc->freq & 0xff);
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM, "EEPROM freq offset %d\n",
+ sc->freq & 0xff);
run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_FREQ_LEDS :
RT3593_EEPROM_FREQ_LEDS, &val);
sc->led[1] = 0x2221;
sc->led[2] = 0x5627; /* differs from RT2860 */
}
- DPRINTF("EEPROM LED mode=0x%02x, LEDs=0x%04x/0x%04x/0x%04x\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM,
+ "EEPROM LED mode=0x%02x, LEDs=0x%04x/0x%04x/0x%04x\n",
sc->leds, sc->led[0], sc->led[1], sc->led[2]);
/* read RF information */
if (val == 0xffff) {
device_printf(sc->sc_dev,
"invalid EEPROM antenna info, using default\n");
- DPRINTF("invalid EEPROM antenna info, using default\n");
if (sc->mac_ver == 0x3572) {
/* default to RF3052 2T2R */
sc->rf_rev = RT3070_RF_3052;
sc->ntxchains = (val >> 4) & 0xf;
sc->nrxchains = val & 0xf;
}
- DPRINTF("EEPROM RF rev=0x%04x chains=%dT%dR\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM, "EEPROM RF rev=0x%04x chains=%dT%dR\n",
sc->rf_rev, sc->ntxchains, sc->nrxchains);
/* check if RF supports automatic Tx access gain control */
run_srom_read(sc, RT2860_EEPROM_CONFIG, &val);
- DPRINTF("EEPROM CFG 0x%04x\n", val);
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM, "EEPROM CFG 0x%04x\n", val);
/* check if driver should patch the DAC issue */
if ((val >> 8) != 0xff)
sc->patch_dac = (val >> 15) & 1;
if (!(val & 0x40)) /* negative number */
delta_5ghz = -delta_5ghz;
}
- DPRINTF("power compensation=%d (2GHz), %d (5GHz)\n",
- delta_2ghz, delta_5ghz);
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM | RUN_DEBUG_TXPWR,
+ "power compensation=%d (2GHz), %d (5GHz)\n", delta_2ghz, delta_5ghz);
for (ridx = 0; ridx < 5; ridx++) {
uint32_t reg;
sc->txpow40mhz_2ghz[ridx] = b4inc(reg, delta_2ghz);
sc->txpow40mhz_5ghz[ridx] = b4inc(reg, delta_5ghz);
- DPRINTF("ridx %d: power 20MHz=0x%08x, 40MHz/2GHz=0x%08x, "
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM | RUN_DEBUG_TXPWR,
+ "ridx %d: power 20MHz=0x%08x, 40MHz/2GHz=0x%08x, "
"40MHz/5GHz=0x%08x\n", ridx, sc->txpow20mhz[ridx],
sc->txpow40mhz_2ghz[ridx], sc->txpow40mhz_5ghz[ridx]);
}
if ((val & 0xff) != 0xff)
sc->txmixgain_2ghz = val & 0x7;
}
- DPRINTF("tx mixer gain=%u (2GHz)\n", sc->txmixgain_2ghz);
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM, "tx mixer gain=%u (2GHz)\n",
+ sc->txmixgain_2ghz);
} else
sc->rssi_2ghz[2] = val & 0xff; /* Ant C */
if (sc->mac_ver == 0x3593)
*/
if ((val & 0xff) != 0xff)
sc->txmixgain_5ghz = val & 0x7;
- DPRINTF("tx mixer gain=%u (5GHz)\n", sc->txmixgain_5ghz);
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM, "tx mixer gain=%u (5GHz)\n",
+ sc->txmixgain_5ghz);
} else
sc->rssi_5ghz[2] = val & 0xff; /* Ant C */
if (sc->mac_ver == 0x3593) {
/* fix broken 5GHz LNA entries */
if (sc->lna[2] == 0 || sc->lna[2] == 0xff) {
- DPRINTF("invalid LNA for channel group %d\n", 2);
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM,
+ "invalid LNA for channel group %d\n", 2);
sc->lna[2] = sc->lna[1];
}
if (sc->lna[3] == 0 || sc->lna[3] == 0xff) {
- DPRINTF("invalid LNA for channel group %d\n", 3);
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM,
+ "invalid LNA for channel group %d\n", 3);
sc->lna[3] = sc->lna[1];
}
/* fix broken RSSI offset entries */
for (ant = 0; ant < 3; ant++) {
if (sc->rssi_2ghz[ant] < -10 || sc->rssi_2ghz[ant] > 10) {
- DPRINTF("invalid RSSI%d offset: %d (2GHz)\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM | RUN_DEBUG_RSSI,
+ "invalid RSSI%d offset: %d (2GHz)\n",
ant + 1, sc->rssi_2ghz[ant]);
sc->rssi_2ghz[ant] = 0;
}
if (sc->rssi_5ghz[ant] < -10 || sc->rssi_5ghz[ant] > 10) {
- DPRINTF("invalid RSSI%d offset: %d (5GHz)\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_ROM | RUN_DEBUG_RSSI,
+ "invalid RSSI%d offset: %d (5GHz)\n",
ant + 1, sc->rssi_5ghz[ant]);
sc->rssi_5ghz[ant] = 0;
}
ni = ieee80211_ref_node(vap->iv_bss);
rn = RUN_NODE(ni);
rn->fix_ridx = ridx;
- DPRINTF("rate=%d, fix_ridx=%d\n", rate, rn->fix_ridx);
+ RUN_DPRINTF(sc, RUN_DEBUG_RATE, "rate=%d, fix_ridx=%d\n",
+ rate, rn->fix_ridx);
ieee80211_free_node(ni);
}
uint8_t bid = 1 << rvp->rvp_id;
ostate = vap->iv_state;
- DPRINTF("%s -> %s\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_STATE, "%s -> %s\n",
ieee80211_state_name[ostate],
ieee80211_state_name[nstate]);
break;
default:
- DPRINTFN(6, "undefined case\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_STATE, "undefined state\n");
break;
}
err:
RUN_UNLOCK(sc);
if (error)
- DPRINTF("WME update failed\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_USB, "WME update failed\n");
return (error);
}
mode = RT2860_MODE_AES_CCMP;
break;
default:
- DPRINTF("undefined case\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_KEY, "undefined case\n");
return;
}
- DPRINTFN(1, "associd=%x, keyix=%d, mode=%x, type=%s, tx=%s, rx=%s\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_KEY,
+ "associd=%x, keyix=%d, mode=%x, type=%s, tx=%s, rx=%s\n",
associd, k->wk_keyix, mode,
(k->wk_flags & IEEE80211_KEY_GROUP) ? "group" : "pairwise",
(k->wk_flags & IEEE80211_KEY_XMIT) ? "on" : "off",
uint32_t i;
i = RUN_CMDQ_GET(&sc->cmdq_store);
- DPRINTF("cmdq_store=%d\n", i);
+ RUN_DPRINTF(sc, RUN_DEBUG_KEY, "cmdq_store=%d\n", i);
sc->cmdq[i].func = run_key_set_cb;
sc->cmdq[i].arg0 = NULL;
sc->cmdq[i].arg1 = vap;
if (k->wk_flags & IEEE80211_KEY_GROUP) {
/* remove group key */
- DPRINTF("removing group key\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_KEY, "removing group key\n");
run_read(sc, RT2860_SKEY_MODE_0_7, &attr);
attr &= ~(0xf << (k->wk_keyix * 4));
run_write(sc, RT2860_SKEY_MODE_0_7, attr);
} else {
/* remove pairwise key */
- DPRINTF("removing key for wcid %x\n", k->wk_pad);
+ RUN_DPRINTF(sc, RUN_DEBUG_KEY,
+ "removing key for wcid %x\n", k->wk_pad);
/* matching wcid was written to wk_pad in run_key_set() */
wcid = k->wk_pad;
run_read(sc, RT2860_WCID_ATTR(wcid), &attr);
* So, use atomic instead.
*/
i = RUN_CMDQ_GET(&sc->cmdq_store);
- DPRINTF("cmdq_store=%d\n", i);
+ RUN_DPRINTF(sc, RUN_DEBUG_KEY, "cmdq_store=%d\n", i);
sc->cmdq[i].func = run_key_delete_cb;
sc->cmdq[i].arg0 = NULL;
sc->cmdq[i].arg1 = sc;
for (;;) {
/* drain Tx status FIFO (maxsize = 16) */
run_read(sc, RT2860_TX_STAT_FIFO, &stat);
- DPRINTFN(4, "tx stat 0x%08x\n", stat);
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT, "tx stat 0x%08x\n", stat);
if (!(stat & RT2860_TXQ_VLD))
break;
(*wstat)[RUN_RETRY] += retry;
}
}
- DPRINTFN(3, "count=%d\n", sc->fifo_cnt);
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT, "count=%d\n", sc->fifo_cnt);
sc->fifo_cnt = 0;
}
txs->nframes = txs->nretries + txs->nsuccess +
le16toh(sta[0].error.fail);
- DPRINTFN(3, "retrycnt=%d success=%d failcnt=%d\n",
- txs->nretries, txs->nsuccess,
- le16toh(sta[0].error.fail));
+ RUN_DPRINTF(sc, RUN_DEBUG_RATE,
+ "retrycnt=%d success=%d failcnt=%d\n",
+ txs->nretries, txs->nsuccess, le16toh(sta[0].error.fail));
} else {
wstat = &(sc->wcid_stats[RUN_AID2WCID(ni->ni_associd)]);
txs->nretries = (*wstat)[RUN_RETRY];
txs->nsuccess = (*wstat)[RUN_SUCCESS];
txs->nframes = (*wstat)[RUN_TXCNT];
- DPRINTFN(3, "retrycnt=%d txcnt=%d success=%d\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_RATE,
+ "retrycnt=%d txcnt=%d success=%d\n",
txs->nretries, txs->nframes, txs->nsuccess);
memset(wstat, 0, sizeof(*wstat));
fail:
RUN_UNLOCK(sc);
- DPRINTFN(3, "ridx=%d\n", rn->amrr_ridx);
+ RUN_DPRINTF(sc, RUN_DEBUG_RATE, "ridx=%d\n", rn->amrr_ridx);
}
static void
* Need to defer.
*/
uint32_t cnt = RUN_CMDQ_GET(&sc->cmdq_store);
- DPRINTF("cmdq_store=%d\n", cnt);
+ RUN_DPRINTF(sc, RUN_DEBUG_STATE, "cmdq_store=%d\n", cnt);
sc->cmdq[cnt].func = run_newassoc_cb;
sc->cmdq[cnt].arg0 = NULL;
sc->cmdq[cnt].arg1 = ni;
ieee80211_runtask(ic, &sc->cmdq_task);
}
- DPRINTF("new assoc isnew=%d associd=%x addr=%s\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_STATE,
+ "new assoc isnew=%d associd=%x addr=%s\n",
isnew, ni->ni_associd, ether_sprintf(ni->ni_macaddr));
for (i = 0; i < rs->rs_nrates; i++) {
/* no basic rate found, use mandatory one */
rn->ctl_ridx[i] = rt2860_rates[ridx].ctl_ridx;
}
- DPRINTF("rate=0x%02x ridx=%d ctl_ridx=%d\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_STATE | RUN_DEBUG_RATE,
+ "rate=0x%02x ridx=%d ctl_ridx=%d\n",
rs->rs_rates[i], rn->ridx[i], rn->ctl_ridx[i]);
}
rate = vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)].mgmtrate;
if (rt2860_rates[ridx].rate == rate)
break;
rn->mgt_ridx = ridx;
- DPRINTF("rate=%d, mgmt_ridx=%d\n", rate, rn->mgt_ridx);
+ RUN_DPRINTF(sc, RUN_DEBUG_STATE | RUN_DEBUG_RATE,
+ "rate=%d, mgmt_ridx=%d\n", rate, rn->mgt_ridx);
RUN_LOCK(sc);
if(sc->ratectl_run != RUN_RATECTL_OFF)
rx_tstamp = le64toh(rx_tstamp);
if (ni_tstamp >= rx_tstamp) {
- DPRINTF("ibss merge, tsf %ju tstamp %ju\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_RECV | RUN_DEBUG_BEACON,
+ "ibss merge, tsf %ju tstamp %ju\n",
(uintmax_t)rx_tstamp, (uintmax_t)ni_tstamp);
(void) ieee80211_ibss_merge(ni);
}
if (__predict_false(len > dmalen)) {
m_freem(m);
counter_u64_add(ic->ic_ierrors, 1);
- DPRINTF("bad RXWI length %u > %u\n", len, dmalen);
+ RUN_DPRINTF(sc, RUN_DEBUG_RECV,
+ "bad RXWI length %u > %u\n", len, dmalen);
return;
}
/* Rx descriptor is located at the end */
if (__predict_false(flags & (RT2860_RX_CRCERR | RT2860_RX_ICVERR))) {
m_freem(m);
counter_u64_add(ic->ic_ierrors, 1);
- DPRINTF("%s error.\n", (flags & RT2860_RX_CRCERR)?"CRC":"ICV");
+ RUN_DPRINTF(sc, RUN_DEBUG_RECV, "%s error.\n",
+ (flags & RT2860_RX_CRCERR)?"CRC":"ICV");
return;
}
}
if (flags & RT2860_RX_L2PAD) {
- DPRINTFN(8, "received RT2860_RX_L2PAD frame\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_RECV,
+ "received RT2860_RX_L2PAD frame\n");
len += 2;
}
rxwi->keyidx);
m_freem(m);
counter_u64_add(ic->ic_ierrors, 1);
- DPRINTF("MIC error. Someone is lying.\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_RECV,
+ "MIC error. Someone is lying.\n");
return;
}
switch (USB_GET_STATE(xfer)) {
case USB_ST_TRANSFERRED:
- DPRINTFN(15, "rx done, actlen=%d\n", xferlen);
+ RUN_DPRINTF(sc, RUN_DEBUG_RECV,
+ "rx done, actlen=%d\n", xferlen);
if (xferlen < (int)(sizeof(uint32_t) + rxwisize +
sizeof(struct rt2870_rxd))) {
- DPRINTF("xfer too short %d\n", xferlen);
+ RUN_DPRINTF(sc, RUN_DEBUG_RECV_DESC | RUN_DEBUG_USB,
+ "xfer too short %d\n", xferlen);
goto tr_setup;
}
MJUMPAGESIZE /* xfer can be bigger than MCLBYTES */);
}
if (sc->rx_m == NULL) {
- DPRINTF("could not allocate mbuf - idle with stall\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_RECV | RUN_DEBUG_RECV_DESC,
+ "could not allocate mbuf - idle with stall\n");
counter_u64_add(ic->ic_ierrors, 1);
usbd_xfer_set_stall(xfer);
usbd_xfer_set_frames(xfer, 0);
if ((dmalen >= (uint32_t)-8) || (dmalen == 0) ||
((dmalen & 3) != 0)) {
- DPRINTF("bad DMA length %u\n", dmalen);
+ RUN_DPRINTF(sc, RUN_DEBUG_RECV_DESC | RUN_DEBUG_USB,
+ "bad DMA length %u\n", dmalen);
break;
}
if ((dmalen + 8) > (uint32_t)xferlen) {
- DPRINTF("bad DMA length %u > %d\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_RECV_DESC | RUN_DEBUG_USB,
+ "bad DMA length %u > %d\n",
dmalen + 8, xferlen);
break;
}
/* copy aggregated frames to another mbuf */
m0 = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
if (__predict_false(m0 == NULL)) {
- DPRINTF("could not allocate mbuf\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_RECV_DESC,
+ "could not allocate mbuf\n");
counter_u64_add(ic->ic_ierrors, 1);
break;
}
switch (USB_GET_STATE(xfer)) {
case USB_ST_TRANSFERRED:
- DPRINTFN(11, "transfer complete: %d "
- "bytes @ index %d\n", actlen, index);
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT | RUN_DEBUG_USB,
+ "transfer complete: %d bytes @ index %d\n", actlen, index);
data = usbd_xfer_get_priv(xfer);
run_tx_free(pq, data, 0);
sizeof(data->desc) + sizeof(uint32_t) : sizeof(data->desc);
if ((m->m_pkthdr.len +
size + 3 + 8) > RUN_MAX_TXSZ) {
- DPRINTF("data overflow, %u bytes\n",
- m->m_pkthdr.len);
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT_DESC | RUN_DEBUG_USB,
+ "data overflow, %u bytes\n", m->m_pkthdr.len);
run_tx_free(pq, data, 1);
goto tr_setup;
}
ieee80211_radiotap_tx(vap, m);
}
- DPRINTFN(11, "sending frame len=%u/%u @ index %d\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT | RUN_DEBUG_USB,
+ "sending frame len=%u/%u @ index %d\n",
m->m_pkthdr.len, size, index);
usbd_xfer_set_frame_len(xfer, 0, size);
break;
default:
- DPRINTF("USB transfer error, %s\n",
- usbd_errstr(error));
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT | RUN_DEBUG_USB,
+ "USB transfer error, %s\n", usbd_errstr(error));
data = usbd_xfer_get_priv(xfer);
if (error == USB_ERR_TIMEOUT) {
device_printf(sc->sc_dev, "device timeout\n");
uint32_t i = RUN_CMDQ_GET(&sc->cmdq_store);
- DPRINTF("cmdq_store=%d\n", i);
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT | RUN_DEBUG_USB,
+ "cmdq_store=%d\n", i);
sc->cmdq[i].func = run_usb_timeout_cb;
sc->cmdq[i].arg0 = vap;
ieee80211_runtask(ic, &sc->cmdq_task);
}
qflags = (qid < 4) ? RT2860_TX_QSEL_EDCA : RT2860_TX_QSEL_HCCA;
- DPRINTFN(8, "qos %d\tqid %d\ttid %d\tqflags %x\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT, "qos %d\tqid %d\ttid %d\tqflags %x\n",
qos, qid, tid, qflags);
chan = (ni->ni_chan != IEEE80211_CHAN_ANYC)?ni->ni_chan:ic->ic_curchan;
/* reserve slots for mgmt packets, just in case */
if (sc->sc_epq[qid].tx_nfree < 3) {
- DPRINTFN(10, "tx ring %d is full\n", qid);
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT, "tx ring %d is full\n", qid);
return (-1);
}
* with a non-sleepable lock, tcpinp. So, need to defer.
*/
uint32_t i = RUN_CMDQ_GET(&sc->cmdq_store);
- DPRINTFN(6, "cmdq_store=%d\n", i);
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT, "cmdq_store=%d\n", i);
sc->cmdq[i].func = run_drain_fifo;
sc->cmdq[i].arg0 = sc;
ieee80211_runtask(ic, &sc->cmdq_task);
usbd_transfer_start(sc->sc_xfer[qid]);
- DPRINTFN(8, "sending data frame len=%d rate=%d qid=%d\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT,
+ "sending data frame len=%d rate=%d qid=%d\n",
m->m_pkthdr.len + (int)(sizeof(struct rt2870_txd) +
sizeof(struct rt2860_txwi)), rt2860_rates[ridx].rate, qid);
run_set_tx_desc(sc, data);
- DPRINTFN(10, "sending mgt frame len=%d rate=%d\n", m->m_pkthdr.len +
- (int)(sizeof(struct rt2870_txd) + sizeof(struct rt2860_txwi)),
- rt2860_rates[ridx].rate);
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT, "sending mgt frame len=%d rate=%d\n",
+ m->m_pkthdr.len + (int)(sizeof(struct rt2870_txd) +
+ sizeof(struct rt2860_txwi)), rt2860_rates[ridx].rate);
STAILQ_INSERT_TAIL(&sc->sc_epq[0].tx_qh, data, next);
}
if (mprot == NULL) {
if_inc_counter(ni->ni_vap->iv_ifp, IFCOUNTER_OERRORS, 1);
- DPRINTF("could not allocate mbuf\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT, "could not allocate mbuf\n");
return (ENOBUFS);
}
run_set_tx_desc(sc, data);
- DPRINTFN(1, "sending prot len=%u rate=%u\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT, "sending prot len=%u rate=%u\n",
m->m_pkthdr.len, rate);
STAILQ_INSERT_TAIL(&sc->sc_epq[0].tx_qh, data, next);
if (sc->sc_epq[0].tx_nfree == 0) {
/* let caller free mbuf */
- DPRINTF("sending raw frame, but tx ring is full\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT,
+ "sending raw frame, but tx ring is full\n");
return (EIO);
}
data = STAILQ_FIRST(&sc->sc_epq[0].tx_fh);
run_set_tx_desc(sc, data);
- DPRINTFN(10, "sending raw frame len=%u rate=%u\n",
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT, "sending raw frame len=%u rate=%u\n",
m->m_pkthdr.len, rate);
STAILQ_INSERT_TAIL(&sc->sc_epq[0].tx_qh, data, next);
if (params == NULL) {
/* tx mgt packet */
if ((error = run_tx_mgt(sc, m, ni)) != 0) {
- DPRINTF("mgt tx failed\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT, "mgt tx failed\n");
goto done;
}
} else {
/* tx raw packet with param */
if ((error = run_tx_param(sc, m, ni, params)) != 0) {
- DPRINTF("tx with param failed\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT, "tx with param failed\n");
goto done;
}
}
ieee80211_beacon_update(ni, rvp->beacon_mbuf, mcast);
i = RUN_CMDQ_GET(&sc->cmdq_store);
- DPRINTF("cmdq_store=%d\n", i);
+ RUN_DPRINTF(sc, RUN_DEBUG_BEACON, "cmdq_store=%d\n", i);
sc->cmdq[i].func = run_update_beacon_cb;
sc->cmdq[i].arg0 = vap;
ieee80211_runtask(ic, &sc->cmdq_task);
uint32_t i;
i = RUN_CMDQ_GET(&sc->cmdq_store);
- DPRINTF("cmdq_store=%d\n", i);
+ RUN_DPRINTF(sc, RUN_DEBUG_BEACON, "cmdq_store=%d\n", i);
sc->cmdq[i].func = run_updateprot_cb;
sc->cmdq[i].arg0 = ic;
ieee80211_runtask(ic, &sc->cmdq_task);
vap->iv_opmode != IEEE80211_M_STA)
run_reset_livelock(sc);
else if (vap->iv_state == IEEE80211_S_SCAN) {
- DPRINTF("timeout caused by scan\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_USB | RUN_DEBUG_STATE,
+ "timeout caused by scan\n");
/* cancel bgscan */
ieee80211_cancel_scan(vap);
} else
- DPRINTF("timeout by unknown cause\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_USB | RUN_DEBUG_STATE,
+ "timeout by unknown cause\n");
}
static void
* crazy if protection is enabled. Reset MAC/BBP for a while
*/
run_read(sc, RT2860_DEBUG, &tmp);
- DPRINTFN(3, "debug reg %08x\n", tmp);
+ RUN_DPRINTF(sc, RUN_DEBUG_RESET, "debug reg %08x\n", tmp);
if ((tmp & (1 << 29)) && (tmp & (1 << 7 | 1 << 5))) {
- DPRINTF("CTS-to-self livelock detected\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_RESET,
+ "CTS-to-self livelock detected\n");
run_write(sc, RT2860_MAC_SYS_CTRL, RT2860_MAC_SRST);
run_delay(sc, 1);
run_write(sc, RT2860_MAC_SYS_CTRL,
run_write(sc, RT2860_RX_FILTR_CFG, tmp);
- DPRINTF("%s promiscuous mode\n", (sc->sc_ic.ic_promisc > 0) ?
- "entering" : "leaving");
+ RUN_DPRINTF(sc, RUN_DEBUG_RECV, "%s promiscuous mode\n",
+ (sc->sc_ic.ic_promisc > 0) ? "entering" : "leaving");
}
static void
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
uint32_t tmp;
- DPRINTF("rvp_id=%d ic_opmode=%d\n", RUN_VAP(vap)->rvp_id,
- ic->ic_opmode);
+ RUN_DPRINTF(sc, RUN_DEBUG_BEACON, "rvp_id=%d ic_opmode=%d\n",
+ RUN_VAP(vap)->rvp_id, ic->ic_opmode);
run_read(sc, RT2860_BCN_TIME_CFG, &tmp);
tmp &= ~0x1fffff;
/* SYNC with nobody */
tmp |= 3 << RT2860_TSF_SYNC_MODE_SHIFT;
} else {
- DPRINTF("Enabling TSF failed. undefined opmode\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_BEACON,
+ "Enabling TSF failed. undefined opmode\n");
return;
}
uint32_t i;
i = RUN_CMDQ_GET(&sc->cmdq_store);
- DPRINTF("cmdq_store=%d\n", i);
+ RUN_DPRINTF(sc, RUN_DEBUG_BEACON, "cmdq_store=%d\n", i);
sc->cmdq[i].func = run_updateslot_cb;
sc->cmdq[i].arg0 = ic;
ieee80211_runtask(ic, &sc->cmdq_task);
/* wait for pending Tx to complete */
for (ntries = 0; ntries < 100; ntries++) {
if (run_read(sc, RT2860_TXRXQ_PCNT, &tmp) != 0) {
- DPRINTF("Cannot read Tx queue count\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT | RUN_DEBUG_RESET,
+ "Cannot read Tx queue count\n");
break;
}
if ((tmp & RT2860_TX2Q_PCNT_MASK) == 0) {
- DPRINTF("All Tx cleared\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT | RUN_DEBUG_RESET,
+ "All Tx cleared\n");
break;
}
run_delay(sc, 10);
}
if (ntries >= 100)
- DPRINTF("There are still pending Tx\n");
+ RUN_DPRINTF(sc, RUN_DEBUG_XMIT | RUN_DEBUG_RESET,
+ "There are still pending Tx\n");
run_delay(sc, 10);
run_write(sc, RT2860_USB_DMA_CFG, 0);