-/* $OpenBSD: ath.c,v 1.123 2022/04/21 21:03:02 stsp Exp $ */
+/* $OpenBSD: ath.c,v 1.124 2023/03/26 08:45:27 jsg Exp $ */
/* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */
/*-
timeout_set(&sc->sc_cal_to, ath_calibrate, sc);
timeout_set(&sc->sc_rssadapt_to, ath_rssadapt_updatestats, sc);
-#ifdef __FreeBSD__
- ATH_TXBUF_LOCK_INIT(sc);
- ATH_TXQ_LOCK_INIT(sc);
-#endif
-
ATH_TASK_INIT(&sc->sc_txtask, ath_tx_proc, sc);
ATH_TASK_INIT(&sc->sc_rxtask, ath_rx_proc, sc);
ATH_TASK_INIT(&sc->sc_rxorntask, ath_rxorn_proc, sc);
ifp->if_start = ath_start;
ifp->if_watchdog = ath_watchdog;
ifp->if_ioctl = ath_ioctl;
-#ifndef __OpenBSD__
- ifp->if_stop = ath_stop; /* XXX */
-#endif
ifq_set_maxlen(&ifp->if_snd, ATH_TXBUF * ATH_TXDESC);
ic->ic_softc = sc;
if_detach(ifp);
splx(s);
-#ifdef __FreeBSD__
- ATH_TXBUF_LOCK_DESTROY(sc);
- ATH_TXQ_LOCK_DESTROY(sc);
-#endif
return 0;
}
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
-#ifdef __FreeBSD__
- /*
- * The upper layer has already installed/removed
- * the multicast address(es), just recalculate the
- * multicast filter for the card.
- */
- if (ifp->if_flags & IFF_RUNNING)
- ath_mode_init(sc);
-#endif
error = (cmd == SIOCADDMULTI) ?
ether_addmulti(ifr, &sc->sc_ic.ic_ac) :
ether_delmulti(ifr, &sc->sc_ic.ic_ac);
struct mbuf *m;
KASSERT(pktlen <= MCLBYTES, ("802.11 packet too large: %u", pktlen));
-#ifdef __FreeBSD__
- if (pktlen <= MHLEN) {
- MGETHDR(m, flags, type);
- } else {
- m = m_getcl(flags, type, M_PKTHDR);
- }
-#else
MGETHDR(m, flags, type);
if (m != NULL && pktlen > MHLEN) {
MCLGET(m, flags);
m = NULL;
}
}
-#endif
return m;
}
-/* $OpenBSD: athvar.h,v 1.35 2020/10/11 07:05:28 mpi Exp $ */
+/* $OpenBSD: athvar.h,v 1.36 2023/03/26 08:45:27 jsg Exp $ */
/* $NetBSD: athvar.h,v 1.10 2004/08/10 01:03:53 dyoung Exp $ */
/*-
} ath_task_t;
struct ath_softc {
-#ifndef __FreeBSD__
struct device sc_dev;
-#endif
struct ieee80211com sc_ic; /* IEEE 802.11 common */
-#ifndef __FreeBSD__
int (*sc_enable)(struct ath_softc *);
void (*sc_disable)(struct ath_softc *);
void (*sc_power)(struct ath_softc *, int);
-#endif
int (*sc_newstate)(struct ieee80211com *,
enum ieee80211_state, int);
void (*sc_node_free)(struct ieee80211com *,
void (*sc_recv_mgmt)(struct ieee80211com *,
struct mbuf *, struct ieee80211_node *,
struct ieee80211_rxinfo *, int);
-#ifdef __FreeBSD__
- device_t sc_dev;
-#endif
bus_space_tag_t sc_st; /* bus space tag */
bus_space_handle_t sc_sh; /* bus space handle */
bus_size_t sc_ss; /* bus space size */
bus_dma_tag_t sc_dmat; /* bus DMA tag */
-#ifdef __FreeBSD__
- struct mtx sc_mtx; /* master lock (recursive) */
-#endif
struct ath_hal *sc_ah; /* Atheros HAL */
unsigned int sc_invalid : 1, /* disable hardware accesses */
sc_doani : 1, /* dynamic noise immunity */
u_int32_t *sc_txlink; /* link ptr in last TX desc */
int sc_tx_timer; /* transmit timeout */
TAILQ_HEAD(, ath_buf) sc_txbuf; /* transmit buffer */
-#ifdef __FreeBSD__
- struct mtx sc_txbuflock; /* txbuf lock */
-#endif
TAILQ_HEAD(, ath_buf) sc_txq; /* transmitting queue */
-#ifdef __FreeBSD__
- struct mtx sc_txqlock; /* lock on txq and txlink */
-#endif
ath_task_t sc_txtask; /* tx int processing */
u_int sc_bhalq; /* HAL q for outgoing beacons */
ath_task_t sc_swbatask; /* swba int processing */
ath_task_t sc_bmisstask; /* bmiss int processing */
-#ifdef __OpenBSD__
struct timeval sc_last_ch;
struct timeout sc_cal_to;
struct timeval sc_last_beacon;
struct timeout sc_scan_to;
struct timeout sc_rssadapt_to;
-#else
- struct callout sc_cal_ch; /* callout handle for cals */
- struct callout sc_scan_ch; /* callout handle for scan */
-#endif
struct ath_stats sc_stats; /* interface statistics */
HAL_MIB_STATS sc_mib_stats; /* MIB counter statistics */
-#ifndef __FreeBSD__
u_int sc_flags; /* misc flags */
-#endif
u_int8_t sc_broadcast_addr[IEEE80211_ADDR_LEN];
/*
* Wrapper code
*/
-#ifndef __FreeBSD__
#undef KASSERT
#define KASSERT(cond, complaint) if (!(cond)) panic complaint
#define ATH_GPIO 0x0004 /* gpio device attached */
#define ATH_IS_ENABLED(sc) ((sc)->sc_flags & ATH_ENABLED)
-#endif
#define ATH_LOCK_INIT(_sc) \
mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \