Update ipw to work with the new net80211 stack, plus other driver improvements.
- Add proper scanning support rather than letting the firmware grab the first access point - Overhaul state changes - Use macros for locking and provide _locked() versions of some functions - Increase debugging output - Use a callout rather than the old watchdog interface - Improve style, function names and defines - Add WPA (TKIP) support Based heavily on a patchset provided by Sam Leffler.
This commit is contained in:
parent
58809b0788
commit
a7a6cc62cb
1039
sys/dev/ipw/if_ipw.c
1039
sys/dev/ipw/if_ipw.c
File diff suppressed because it is too large
Load Diff
@ -88,11 +88,18 @@
|
||||
#define IPW_IO_LED_OFF 0x00002000
|
||||
#define IPW_IO_RADIO_DISABLED 0x00010000
|
||||
|
||||
/* state codes sent by fw on IPW_STATUS_CODE_NEWSTATE interrupt */
|
||||
#define IPW_STATE_INITIALIZED 0x0001
|
||||
#define IPW_STATE_CC_FOUND 0x0002 /* 802.11d cc received */
|
||||
#define IPW_STATE_ASSOCIATED 0x0004
|
||||
#define IPW_STATE_ASSOCIATION_LOST 0x0008
|
||||
#define IPW_STATE_ASSOCIATION_CHANGED 0x0010 /* assoc params changed? */
|
||||
#define IPW_STATE_SCAN_COMPLETE 0x0020
|
||||
#define IPW_STATE_PS_ENTER 0x0040 /* entered power-save mode */
|
||||
#define IPW_STATE_PS_EXIT 0x0080 /* exited power-save mode */
|
||||
#define IPW_STATE_RADIO_DISABLED 0x0100
|
||||
#define IPW_STATE_DISABLED 0x0200
|
||||
#define IPW_STATE_POWER_DOWN 0x0400 /* ??? */
|
||||
#define IPW_STATE_SCANNING 0x0800
|
||||
|
||||
/* table1 offsets */
|
||||
@ -146,7 +153,9 @@ struct ipw_status {
|
||||
uint8_t flags;
|
||||
#define IPW_STATUS_FLAG_DECRYPTED 0x01
|
||||
#define IPW_STATUS_FLAG_WEP_ENCRYPTED 0x02
|
||||
#define IPW_STATUS_FLAG_CRC_ERROR 0x04
|
||||
uint8_t rssi; /* received signal strength indicator */
|
||||
#define IPW_RSSI_TO_DBM (-98) /* XXX fixed nf to convert dBm */
|
||||
} __packed;
|
||||
|
||||
/* data header */
|
||||
@ -190,9 +199,14 @@ struct ipw_cmd {
|
||||
#define IPW_CMD_DISABLE 44
|
||||
#define IPW_CMD_SET_DESIRED_BSSID 45
|
||||
#define IPW_CMD_SET_SCAN_OPTIONS 46
|
||||
#define IPW_CMD_SET_SCAN_DWELL_TIME 47
|
||||
#define IPW_CMD_SET_SHORT_RETRY 51
|
||||
#define IPW_CMD_SET_LONG_RETRY 52
|
||||
#define IPW_CMD_PREPARE_POWER_DOWN 58
|
||||
#define IPW_CMD_DISABLE_PHY 61
|
||||
#define IPW_CMD_SET_SECURITY_INFORMATION 67
|
||||
#define IPW_CMD_SET_MSDU_TX_RATES 62
|
||||
#define IPW_CMD_SET_SECURITY_INFO 67
|
||||
#define IPW_CMD_DISASSOCIATE 68
|
||||
#define IPW_CMD_SET_WPA_IE 69
|
||||
uint32_t subtype;
|
||||
uint32_t seq;
|
||||
@ -204,7 +218,7 @@ struct ipw_cmd {
|
||||
|
||||
/* possible values for command IPW_CMD_SET_POWER_MODE */
|
||||
#define IPW_POWER_MODE_CAM 0
|
||||
#define IPW_POWER_AUTOMATIC 6
|
||||
#define IPW_POWER_MODE_AUTO 6
|
||||
|
||||
/* possible values for command IPW_CMD_SET_MODE */
|
||||
#define IPW_MODE_BSS 0
|
||||
@ -241,6 +255,7 @@ struct ipw_security {
|
||||
struct ipw_scan_options {
|
||||
uint32_t flags;
|
||||
#define IPW_SCAN_DO_NOT_ASSOCIATE 0x00000001
|
||||
#define IPW_SCAN_MIXED_CELL 0x00000002
|
||||
#define IPW_SCAN_PASSIVE 0x00000008
|
||||
uint32_t channels;
|
||||
} __packed;
|
||||
|
@ -85,12 +85,21 @@ struct ipw_softc {
|
||||
|
||||
struct mtx sc_mtx;
|
||||
struct task sc_init_task;
|
||||
struct task sc_scan_task;
|
||||
struct task sc_chan_task;
|
||||
struct task sc_assoc_task;
|
||||
struct task sc_disassoc_task;
|
||||
struct callout sc_wdtimer; /* watchdog timer */
|
||||
|
||||
uint32_t flags;
|
||||
#define IPW_FLAG_FW_INITED (1 << 0)
|
||||
#define IPW_FLAG_INIT_LOCKED (1 << 1)
|
||||
#define IPW_FLAG_HAS_RADIO_SWITCH (1 << 2)
|
||||
#define IPW_FLAG_FW_WARNED (1 << 3)
|
||||
#define IPW_FLAG_HACK (1 << 3)
|
||||
#define IPW_FLAG_SCANNING (1 << 4)
|
||||
#define IPW_FLAG_ENABLED (1 << 5)
|
||||
#define IPW_FLAG_BUSY (1 << 6)
|
||||
#define IPW_FLAG_ASSOCIATED (1 << 7)
|
||||
|
||||
int irq_rid;
|
||||
int mem_rid;
|
||||
@ -102,6 +111,7 @@ struct ipw_softc {
|
||||
const struct firmware *sc_firmware;
|
||||
|
||||
int sc_tx_timer;
|
||||
int sc_scan_timer;
|
||||
|
||||
bus_dma_tag_t tbd_dmat;
|
||||
bus_dma_tag_t rbd_dmat;
|
||||
@ -160,3 +170,18 @@ struct ipw_softc {
|
||||
#define sc_txtap sc_txtapu.th
|
||||
int sc_txtap_len;
|
||||
};
|
||||
|
||||
/*
|
||||
* NB.: This models the only instance of async locking in ipw_init_locked
|
||||
* and must be kept in sync.
|
||||
*/
|
||||
#define IPW_LOCK_DECL int __waslocked = 0
|
||||
#define IPW_LOCK(sc) do { \
|
||||
if (!(__waslocked = mtx_owned(&(sc)->sc_mtx))) \
|
||||
mtx_lock(&sc->sc_mtx); \
|
||||
} while (0)
|
||||
#define IPW_UNLOCK(sc) do { \
|
||||
if (!__waslocked) \
|
||||
mtx_unlock(&sc->sc_mtx); \
|
||||
} while (0)
|
||||
#define IPW_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED)
|
||||
|
Loading…
Reference in New Issue
Block a user