-/* $OpenBSD: if_iwm.c,v 1.357 2021/07/20 16:00:47 stsp Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.358 2021/08/19 06:02:04 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
void iwm_stop(struct ifnet *);
void iwm_watchdog(struct ifnet *);
int iwm_ioctl(struct ifnet *, u_long, caddr_t);
-#if 1
const char *iwm_desc_lookup(uint32_t);
void iwm_nic_error(struct iwm_softc *);
void iwm_dump_driver_status(struct iwm_softc *);
void iwm_nic_umac_error(struct iwm_softc *);
-#endif
void iwm_rx_mpdu(struct iwm_softc *, struct mbuf *, void *, size_t,
struct mbuf_list *);
void iwm_flip_address(uint8_t *);
if (sc->sc_tx_timer > 0) {
if (--sc->sc_tx_timer == 0) {
printf("%s: device timeout\n", DEVNAME(sc));
-#if 1
- iwm_nic_error(sc);
- iwm_dump_driver_status(sc);
-#endif
+ if (ifp->if_flags & IFF_DEBUG) {
+ iwm_nic_error(sc);
+ iwm_dump_driver_status(sc);
+ }
if ((sc->sc_flags & IWM_FLAG_SHUTDOWN) == 0)
task_add(systq, &sc->init_task);
ifp->if_oerrors++;
return err;
}
-#if 1
/*
* Note: This structure is read from the device with IO accesses,
* and the reading already does the endian conversion. As it is
printf(" 802.11 state %s\n",
ieee80211_state_name[sc->sc_ic.ic_state]);
}
-#endif
#define SYNC_RESP_STRUCT(_var_, _pkt_) \
do { \
iwm_intr(void *arg)
{
struct iwm_softc *sc = arg;
+ struct ieee80211com *ic = &sc->sc_ic;
+ struct ifnet *ifp = IC2IFP(ic);
int handled = 0;
int rv = 0;
uint32_t r1, r2;
}
if (r1 & IWM_CSR_INT_BIT_SW_ERR) {
-#if 1
- iwm_nic_error(sc);
- iwm_dump_driver_status(sc);
-#endif
-
+ if (ifp->if_flags & IFF_DEBUG) {
+ iwm_nic_error(sc);
+ iwm_dump_driver_status(sc);
+ }
printf("%s: fatal firmware error\n", DEVNAME(sc));
if ((sc->sc_flags & IWM_FLAG_SHUTDOWN) == 0)
task_add(systq, &sc->init_task);
iwm_intr_msix(void *arg)
{
struct iwm_softc *sc = arg;
+ struct ieee80211com *ic = &sc->sc_ic;
+ struct ifnet *ifp = IC2IFP(ic);
uint32_t inta_fh, inta_hw;
int vector = 0;
if ((inta_fh & IWM_MSIX_FH_INT_CAUSES_FH_ERR) ||
(inta_hw & IWM_MSIX_HW_INT_CAUSES_REG_SW_ERR) ||
(inta_hw & IWM_MSIX_HW_INT_CAUSES_REG_SW_ERR_V2)) {
-#if 1
- iwm_nic_error(sc);
- iwm_dump_driver_status(sc);
-#endif
-
+ if (ifp->if_flags & IFF_DEBUG) {
+ iwm_nic_error(sc);
+ iwm_dump_driver_status(sc);
+ }
printf("%s: fatal firmware error\n", DEVNAME(sc));
if ((sc->sc_flags & IWM_FLAG_SHUTDOWN) == 0)
task_add(systq, &sc->init_task);
-/* $OpenBSD: if_iwn.c,v 1.248 2021/04/29 21:43:47 stsp Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.249 2021/08/19 06:02:04 stsp Exp $ */
/*-
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
iwn_mem_write(sc, addr & ~3, tmp);
}
-#ifdef IWN_DEBUG
-
static __inline void
iwn_mem_read_region_4(struct iwn_softc *sc, uint32_t addr, uint32_t *data,
int count)
*data++ = iwn_mem_read(sc, addr);
}
-#endif
-
static __inline void
iwn_mem_set_region_4(struct iwn_softc *sc, uint32_t addr, uint32_t val,
int count)
}
}
-#ifdef IWN_DEBUG
/*
* Dump the error log of the firmware when a firmware panic occurs. Although
* we can't debug the firmware because it is neither open source nor free, it
printf(" rx ring: cur=%d\n", sc->rxq.cur);
printf(" 802.11 state %d\n", sc->sc_ic.ic_state);
}
-#endif
int
iwn_intr(void *arg)
sc->sc_flags &= ~IWN_FLAG_CALIB_DONE;
/* Dump firmware error log and stop. */
-#ifdef IWN_DEBUG
- iwn_fatal_intr(sc);
-#endif
+ if (ifp->if_flags & IFF_DEBUG)
+ iwn_fatal_intr(sc);
iwn_stop(ifp);
task_add(systq, &sc->init_task);
return 1;
-/* $OpenBSD: if_iwx.c,v 1.91 2021/08/16 14:54:50 kevlo Exp $ */
+/* $OpenBSD: if_iwx.c,v 1.92 2021/08/19 06:02:04 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
int iwx_ioctl(struct ifnet *, u_long, caddr_t);
const char *iwx_desc_lookup(uint32_t);
void iwx_nic_error(struct iwx_softc *);
+void iwx_dump_driver_status(struct iwx_softc *);
void iwx_nic_umac_error(struct iwx_softc *);
int iwx_detect_duplicate(struct iwx_softc *, struct mbuf *,
struct iwx_rx_mpdu_desc *, struct ieee80211_rxinfo *);
if (sc->sc_tx_timer > 0) {
if (--sc->sc_tx_timer == 0) {
printf("%s: device timeout\n", DEVNAME(sc));
-#ifdef IWX_DEBUG
- iwx_nic_error(sc);
-#endif
+ if (ifp->if_flags & IFF_DEBUG) {
+ iwx_nic_error(sc);
+ iwx_dump_driver_status(sc);
+ }
if ((sc->sc_flags & IWX_FLAG_SHUTDOWN) == 0)
task_add(systq, &sc->init_task);
ifp->if_oerrors++;
return err;
}
-#if 1 /* usually #ifdef IWX_DEBUG but always enabled for now */
/*
* Note: This structure is read from the device with IO accesses,
* and the reading already does the endian conversion. As it is
if (sc->sc_uc.uc_umac_error_event_table)
iwx_nic_umac_error(sc);
}
-#endif
+
+void
+iwx_dump_driver_status(struct iwx_softc *sc)
+{
+ int i;
+
+ printf("driver status:\n");
+ for (i = 0; i < IWX_MAX_QUEUES; i++) {
+ struct iwx_tx_ring *ring = &sc->txq[i];
+ printf(" tx ring %2d: qid=%-2d cur=%-3d "
+ "queued=%-3d\n",
+ i, ring->qid, ring->cur, ring->queued);
+ }
+ printf(" rx ring: cur=%d\n", sc->rxq.cur);
+ printf(" 802.11 state %s\n",
+ ieee80211_state_name[sc->sc_ic.ic_state]);
+}
#define SYNC_RESP_STRUCT(_var_, _pkt_) \
do { \
iwx_intr(void *arg)
{
struct iwx_softc *sc = arg;
+ struct ieee80211com *ic = &sc->sc_ic;
+ struct ifnet *ifp = IC2IFP(ic);
int handled = 0;
int r1, r2, rv = 0;
}
if (r1 & IWX_CSR_INT_BIT_SW_ERR) {
-#if 1 /* usually #ifdef IWX_DEBUG but always enabled for now */
- int i;
-
- iwx_nic_error(sc);
-
- /* Dump driver status (TX and RX rings) while we're here. */
- printf("driver status:\n");
- for (i = 0; i < IWX_MAX_QUEUES; i++) {
- struct iwx_tx_ring *ring = &sc->txq[i];
- printf(" tx ring %2d: qid=%-2d cur=%-3d "
- "queued=%-3d\n",
- i, ring->qid, ring->cur, ring->queued);
+ if (ifp->if_flags & IFF_DEBUG) {
+ iwx_nic_error(sc);
+ iwx_dump_driver_status(sc);
}
- printf(" rx ring: cur=%d\n", sc->rxq.cur);
- printf(" 802.11 state %s\n",
- ieee80211_state_name[sc->sc_ic.ic_state]);
-#endif
-
printf("%s: fatal firmware error\n", DEVNAME(sc));
if ((sc->sc_flags & IWX_FLAG_SHUTDOWN) == 0)
task_add(systq, &sc->init_task);
iwx_intr_msix(void *arg)
{
struct iwx_softc *sc = arg;
+ struct ieee80211com *ic = &sc->sc_ic;
+ struct ifnet *ifp = IC2IFP(ic);
uint32_t inta_fh, inta_hw;
int vector = 0;
if ((inta_fh & IWX_MSIX_FH_INT_CAUSES_FH_ERR) ||
(inta_hw & IWX_MSIX_HW_INT_CAUSES_REG_SW_ERR) ||
(inta_hw & IWX_MSIX_HW_INT_CAUSES_REG_SW_ERR_V2)) {
-#if 1 /* usually #ifdef IWX_DEBUG but always enabled for now */
- int i;
-
- iwx_nic_error(sc);
-
- /* Dump driver status (TX and RX rings) while we're here. */
- printf("driver status:\n");
- for (i = 0; i < IWX_MAX_QUEUES; i++) {
- struct iwx_tx_ring *ring = &sc->txq[i];
- printf(" tx ring %2d: qid=%-2d cur=%-3d "
- "queued=%-3d\n",
- i, ring->qid, ring->cur, ring->queued);
+ if (ifp->if_flags & IFF_DEBUG) {
+ iwx_nic_error(sc);
+ iwx_dump_driver_status(sc);
}
- printf(" rx ring: cur=%d\n", sc->rxq.cur);
- printf(" 802.11 state %s\n",
- ieee80211_state_name[sc->sc_ic.ic_state]);
-#endif
-
printf("%s: fatal firmware error\n", DEVNAME(sc));
if ((sc->sc_flags & IWX_FLAG_SHUTDOWN) == 0)
task_add(systq, &sc->init_task);