iwm: reorganize if_iwmvar.h
- Change order of data in if_iwmvar.h (like it is in other drivers: defines, data structures, vap/node structures, softc struct and locks); use indentation. - Fix IWM_LOCK(_sc) / IWM_UNLOCK(_sc) macro. - Add IWM_LOCK_INIT / DESTROY(sc) + fix mtx_init() usage. - Wrap iwm_node casts into IWM_NODE() macro. - Drop some fields: * wt_hwqueue from Tx radiotap header; * macaddr[6] from iwm_vap; Approved by: adrian Differential Revision: https://reviews.freebsd.org/D4753
This commit is contained in:
parent
0d4df0290e
commit
612d1816a8
@ -2649,7 +2649,7 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac)
|
||||
{
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
|
||||
struct iwm_node *in = (struct iwm_node *)ni;
|
||||
struct iwm_node *in = IWM_NODE(ni);
|
||||
struct iwm_tx_ring *ring;
|
||||
struct iwm_tx_data *data;
|
||||
struct iwm_tfd *desc;
|
||||
@ -2706,7 +2706,6 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac)
|
||||
tap->wt_chan_freq = htole16(ni->ni_chan->ic_freq);
|
||||
tap->wt_chan_flags = htole16(ni->ni_chan->ic_flags);
|
||||
tap->wt_rate = rinfo->rate;
|
||||
tap->wt_hwqueue = ac;
|
||||
if (k != NULL)
|
||||
tap->wt_flags |= IEEE80211_RADIOTAP_F_WEP;
|
||||
ieee80211_radiotap_tx(vap, m);
|
||||
@ -3182,7 +3181,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc)
|
||||
* freed from underneath us. Grr.
|
||||
*/
|
||||
ni = ieee80211_ref_node(vap->iv_bss);
|
||||
in = (struct iwm_node *) ni;
|
||||
in = IWM_NODE(ni);
|
||||
IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_STATE,
|
||||
"%s: called; vap=%p, bss ni=%p\n",
|
||||
__func__,
|
||||
@ -3289,7 +3288,7 @@ out:
|
||||
static int
|
||||
iwm_assoc(struct ieee80211vap *vap, struct iwm_softc *sc)
|
||||
{
|
||||
struct iwm_node *in = (struct iwm_node *)vap->iv_bss;
|
||||
struct iwm_node *in = IWM_NODE(vap->iv_bss);
|
||||
int error;
|
||||
|
||||
if ((error = iwm_mvm_update_sta(sc, in)) != 0) {
|
||||
@ -3515,7 +3514,7 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
|
||||
if (vap->iv_state == IEEE80211_S_RUN && nstate != vap->iv_state) {
|
||||
iwm_mvm_disable_beacon_filter(sc);
|
||||
|
||||
if (((in = (void *)vap->iv_bss) != NULL))
|
||||
if (((in = IWM_NODE(vap->iv_bss)) != NULL))
|
||||
in->in_assoc = 0;
|
||||
|
||||
iwm_release(sc, NULL);
|
||||
@ -3591,7 +3590,7 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
|
||||
break;
|
||||
}
|
||||
|
||||
in = (struct iwm_node *)vap->iv_bss;
|
||||
in = IWM_NODE(vap->iv_bss);
|
||||
iwm_mvm_power_mac_update_mode(sc, in);
|
||||
iwm_mvm_enable_beacon_filter(sc, in);
|
||||
iwm_mvm_update_quotas(sc, in);
|
||||
@ -4596,7 +4595,7 @@ iwm_attach(device_t dev)
|
||||
int txq_i, i;
|
||||
|
||||
sc->sc_dev = dev;
|
||||
mtx_init(&sc->sc_mtx, "iwm_mtx", MTX_DEF, 0);
|
||||
IWM_LOCK_INIT(sc);
|
||||
mbufq_init(&sc->sc_snd, ifqmaxlen);
|
||||
callout_init_mtx(&sc->sc_watchdog_to, &sc->sc_mtx, 0);
|
||||
TASK_INIT(&sc->sc_es_task, 0, iwm_endscan_cb, sc);
|
||||
@ -4985,7 +4984,7 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211)
|
||||
iwm_pci_detach(dev);
|
||||
|
||||
mbufq_drain(&sc->sc_snd);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
IWM_LOCK_DESTROY(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ iwm_mvm_mac_ctxt_cmd_station(struct iwm_softc *sc, struct ieee80211vap *vap,
|
||||
uint32_t action)
|
||||
{
|
||||
struct ieee80211_node *ni = vap->iv_bss;
|
||||
struct iwm_node *in = (struct iwm_node *) ni;
|
||||
struct iwm_node *in = IWM_NODE(ni);
|
||||
struct iwm_mac_ctx_cmd cmd;
|
||||
|
||||
IWM_DPRINTF(sc, IWM_DEBUG_RESET,
|
||||
|
@ -129,7 +129,6 @@ struct iwm_tx_radiotap_header {
|
||||
uint8_t wt_rate;
|
||||
uint16_t wt_chan_freq;
|
||||
uint16_t wt_chan_flags;
|
||||
uint8_t wt_hwqueue;
|
||||
} __packed;
|
||||
|
||||
#define IWM_TX_RADIOTAP_PRESENT \
|
||||
@ -152,9 +151,6 @@ struct iwm_tx_radiotap_header {
|
||||
#define IWM_FW_STATUS_INPROGRESS 1
|
||||
#define IWM_FW_STATUS_DONE 2
|
||||
|
||||
#define IWM_LOCK(_sc) mtx_lock(&sc->sc_mtx)
|
||||
#define IWM_UNLOCK(_sc) mtx_unlock(&sc->sc_mtx)
|
||||
|
||||
enum iwm_ucode_type {
|
||||
IWM_UCODE_TYPE_INIT,
|
||||
IWM_UCODE_TYPE_REGULAR,
|
||||
@ -295,12 +291,6 @@ struct iwm_rx_ring {
|
||||
int cur;
|
||||
};
|
||||
|
||||
#define IWM_FLAG_USE_ICT 0x01
|
||||
#define IWM_FLAG_HW_INITED 0x02
|
||||
#define IWM_FLAG_STOPPED 0x04
|
||||
#define IWM_FLAG_RFKILL 0x08
|
||||
#define IWM_FLAG_BUSY 0x10
|
||||
|
||||
struct iwm_ucode_status {
|
||||
uint32_t uc_error_event_table;
|
||||
uint32_t uc_log_event_table;
|
||||
@ -372,19 +362,50 @@ struct iwm_bf_data {
|
||||
|
||||
struct iwm_vap {
|
||||
struct ieee80211vap iv_vap;
|
||||
uint8_t macaddr[IEEE80211_ADDR_LEN];
|
||||
int is_uploaded;
|
||||
|
||||
int (*iv_newstate)(struct ieee80211vap *, enum ieee80211_state, int);
|
||||
int (*iv_newstate)(struct ieee80211vap *,
|
||||
enum ieee80211_state, int);
|
||||
};
|
||||
|
||||
#define IWM_VAP(_vap) ((struct iwm_vap *)(_vap))
|
||||
|
||||
struct iwm_node {
|
||||
struct ieee80211_node in_ni;
|
||||
struct iwm_mvm_phy_ctxt *in_phyctxt;
|
||||
|
||||
/* status "bits" */
|
||||
int in_assoc;
|
||||
|
||||
struct iwm_lq_cmd in_lq;
|
||||
|
||||
uint8_t in_ridx[IEEE80211_RATE_MAXSIZE];
|
||||
};
|
||||
#define IWM_NODE(_ni) ((struct iwm_node *)(_ni))
|
||||
|
||||
#define IWM_STATION_ID 0
|
||||
|
||||
#define IWM_DEFAULT_MACID 0
|
||||
#define IWM_DEFAULT_COLOR 0
|
||||
#define IWM_DEFAULT_TSFID 0
|
||||
|
||||
#define IWM_ICT_SIZE 4096
|
||||
#define IWM_ICT_COUNT (IWM_ICT_SIZE / sizeof (uint32_t))
|
||||
#define IWM_ICT_PADDR_SHIFT 12
|
||||
|
||||
struct iwm_softc {
|
||||
device_t sc_dev;
|
||||
uint32_t sc_debug;
|
||||
|
||||
struct mtx sc_mtx;
|
||||
struct mbufq sc_snd;
|
||||
struct ieee80211com sc_ic;
|
||||
device_t sc_dev;
|
||||
|
||||
int sc_flags;
|
||||
#define IWM_FLAG_USE_ICT (1 << 0)
|
||||
#define IWM_FLAG_HW_INITED (1 << 1)
|
||||
#define IWM_FLAG_STOPPED (1 << 2)
|
||||
#define IWM_FLAG_RFKILL (1 << 3)
|
||||
#define IWM_FLAG_BUSY (1 << 4)
|
||||
|
||||
struct intr_config_hook sc_preinit_hook;
|
||||
struct callout sc_watchdog_to;
|
||||
@ -431,8 +452,6 @@ struct iwm_softc {
|
||||
int sc_capa_max_probe_len;
|
||||
|
||||
int sc_intmask;
|
||||
int sc_flags;
|
||||
uint32_t sc_debug;
|
||||
|
||||
/*
|
||||
* So why do we need a separate stopped flag and a generation?
|
||||
@ -491,38 +510,15 @@ struct iwm_softc {
|
||||
|
||||
caddr_t sc_drvbpf;
|
||||
|
||||
union {
|
||||
struct iwm_rx_radiotap_header th;
|
||||
uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
|
||||
} sc_rxtapu;
|
||||
#define sc_rxtap sc_rxtapu.th
|
||||
|
||||
union {
|
||||
struct iwm_tx_radiotap_header th;
|
||||
uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
|
||||
} sc_txtapu;
|
||||
#define sc_txtap sc_txtapu.th
|
||||
struct iwm_rx_radiotap_header sc_rxtap;
|
||||
struct iwm_tx_radiotap_header sc_txtap;
|
||||
|
||||
int sc_max_rssi;
|
||||
};
|
||||
|
||||
#define IWM_DEFAULT_MACID 0
|
||||
#define IWM_DEFAULT_COLOR 0
|
||||
#define IWM_DEFAULT_TSFID 0
|
||||
|
||||
struct iwm_node {
|
||||
struct ieee80211_node in_ni;
|
||||
struct iwm_mvm_phy_ctxt *in_phyctxt;
|
||||
|
||||
/* status "bits" */
|
||||
int in_assoc;
|
||||
|
||||
struct iwm_lq_cmd in_lq;
|
||||
|
||||
uint8_t in_ridx[IEEE80211_RATE_MAXSIZE];
|
||||
};
|
||||
#define IWM_STATION_ID 0
|
||||
|
||||
#define IWM_ICT_SIZE 4096
|
||||
#define IWM_ICT_COUNT (IWM_ICT_SIZE / sizeof (uint32_t))
|
||||
#define IWM_ICT_PADDR_SHIFT 12
|
||||
#define IWM_LOCK_INIT(_sc) \
|
||||
mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \
|
||||
MTX_NETWORK_LOCK, MTX_DEF);
|
||||
#define IWM_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
|
||||
#define IWM_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
|
||||
#define IWM_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx)
|
||||
|
Loading…
x
Reference in New Issue
Block a user