diff options
| -rw-r--r-- | sys/dev/usb/if_rsu.c | 40 | ||||
| -rw-r--r-- | sys/dev/usb/if_rsureg.h | 130 |
2 files changed, 96 insertions, 74 deletions
diff --git a/sys/dev/usb/if_rsu.c b/sys/dev/usb/if_rsu.c index 5b15eea2493..273f42148e9 100644 --- a/sys/dev/usb/if_rsu.c +++ b/sys/dev/usb/if_rsu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rsu.c,v 1.2 2010/12/12 13:55:23 jsg Exp $ */ +/* $OpenBSD: if_rsu.c,v 1.3 2010/12/12 14:03:41 damien Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -163,6 +163,7 @@ int rsu_set_key(struct ieee80211com *, struct ieee80211_node *, void rsu_set_key_cb(struct rsu_softc *, void *); void rsu_delete_key(struct ieee80211com *, struct ieee80211_node *, struct ieee80211_key *); +void rsu_delete_key_cb(struct rsu_softc *, void *); int rsu_site_survey(struct rsu_softc *); int rsu_join_bss(struct rsu_softc *, struct ieee80211_node *); int rsu_disconnect(struct rsu_softc *); @@ -940,7 +941,28 @@ void rsu_delete_key(struct ieee80211com *ic, struct ieee80211_node *ni, struct ieee80211_key *k) { - /* Nothing to do. */ + struct rsu_softc *sc = ic->ic_softc; + struct rsu_cmd_key cmd; + + if (!(ic->ic_if.if_flags & IFF_RUNNING) || + ic->ic_state != IEEE80211_S_RUN) + return; /* Nothing to do. */ + + /* Do it in a process context. */ + cmd.key = *k; + rsu_do_async(sc, rsu_delete_key_cb, &cmd, sizeof(cmd)); +} + +void +rsu_delete_key_cb(struct rsu_softc *sc, void *arg) +{ + struct rsu_cmd_key *cmd = arg; + struct ieee80211_key *k = &cmd->key; + struct r92s_fw_cmd_set_key key; + + memset(&key, 0, sizeof(key)); + key.id = k->k_id; + (void)rsu_fw_cmd(sc, R92S_CMD_SET_KEY, &key, sizeof(key)); } int @@ -1014,7 +1036,7 @@ rsu_join_bss(struct rsu_softc *sc, struct ieee80211_node *ni) memcpy(&fixed->tstamp, ni->ni_tstamp, 8); fixed->bintval = htole16(ni->ni_intval); fixed->capabilities = htole16(ni->ni_capinfo); - /* Write IEs to be included association request. */ + /* Write IEs to be included in the association request. */ frm = (uint8_t *)&fixed[1]; if ((ic->ic_flags & IEEE80211_F_RSNON) && (ni->ni_rsnprotos & IEEE80211_PROTO_RSN)) @@ -1145,11 +1167,11 @@ rsu_rx_event(struct rsu_softc *sc, uint8_t code, uint8_t *buf, int len) DPRINTFN(4, ("Rx event code=%d len=%d\n", code, len)); switch (code) { - case R92S_EVENT_SURVEY: + case R92S_EVT_SURVEY: if (ic->ic_state == IEEE80211_S_SCAN) rsu_event_survey(sc, buf, len); break; - case R92S_EVENT_SURVEY_DONE: + case R92S_EVT_SURVEY_DONE: DPRINTF(("site survey pass %d done, found %d BSS\n", sc->scan_pass, letoh32(*(uint32_t *)buf))); if (ic->ic_state != IEEE80211_S_SCAN) @@ -1163,21 +1185,21 @@ rsu_rx_event(struct rsu_softc *sc, uint8_t code, uint8_t *buf, int len) ieee80211_end_scan(ifp); sc->scan_pass = 0; break; - case R92S_EVENT_JOIN_BSS: + case R92S_EVT_JOIN_BSS: if (ic->ic_state == IEEE80211_S_AUTH) rsu_event_join_bss(sc, buf, len); break; - case R92S_EVENT_DEL_STA: + case R92S_EVT_DEL_STA: DPRINTF(("disassociated from %s\n", ether_sprintf(buf))); if (ic->ic_state == IEEE80211_S_RUN && IEEE80211_ADDR_EQ(ic->ic_bss->ni_bssid, buf)) ieee80211_new_state(ic, IEEE80211_S_SCAN, -1); break; - case R92S_EVENT_WPS_PBC: + case R92S_EVT_WPS_PBC: DPRINTF(("WPS PBC pushed.\n")); break; #ifdef RSU_DEBUG - case R92S_EVENT_FWDBG: + case R92S_EVT_FWDBG: buf[60] = '\0'; printf("FWDBG: %s\n", (char *)buf); break; diff --git a/sys/dev/usb/if_rsureg.h b/sys/dev/usb/if_rsureg.h index 4039c2b0491..47b77aca6fe 100644 --- a/sys/dev/usb/if_rsureg.h +++ b/sys/dev/usb/if_rsureg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rsureg.h,v 1.1 2010/12/11 20:48:21 damien Exp $ */ +/* $OpenBSD: if_rsureg.h,v 1.2 2010/12/12 14:03:41 damien Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -323,32 +323,32 @@ struct r92s_fw_cmd_hdr { #define R92S_CMD_READ_TSSI 73 /* FW events notifications codes. */ -#define R92S_EVENT_READ_MACREG 0 -#define R92S_EVENT_READ_BBREG 1 -#define R92S_EVENT_READ_RFREG 2 -#define R92S_EVENT_READ_EEPROM 3 -#define R92S_EVENT_READ_EFUSE 4 -#define R92S_EVENT_READ_CAM 5 -#define R92S_EVENT_GET_BASICRATE 6 -#define R92S_EVENT_GET_DATARATE 7 -#define R92S_EVENT_SURVEY 8 -#define R92S_EVENT_SURVEY_DONE 9 -#define R92S_EVENT_JOIN_BSS 10 -#define R92S_EVENT_ADD_STA 11 -#define R92S_EVENT_DEL_STA 12 -#define R92S_EVENT_ATIM_DONE 13 -#define R92S_EVENT_TX_REPORT 14 -#define R92S_EVENT_CCX_REPORT 15 -#define R92S_EVENT_DTM_REPORT 16 -#define R92S_EVENT_TXRATE_STATS 17 -#define R92S_EVENT_C2H_LBK 18 -#define R92S_EVENT_FWDBG 19 -#define R92S_EVENT_C2H_FEEDBACK 20 -#define R92S_EVENT_ADDBA 21 -#define R92S_EVENT_C2H_BCN 22 -#define R92S_EVENT_PWR_STATE 23 -#define R92S_EVENT_WPS_PBC 24 -#define R92S_EVENT_ADDBA_REQ_REPORT 25 +#define R92S_EVT_READ_MACREG 0 +#define R92S_EVT_READ_BBREG 1 +#define R92S_EVT_READ_RFREG 2 +#define R92S_EVT_READ_EEPROM 3 +#define R92S_EVT_READ_EFUSE 4 +#define R92S_EVT_READ_CAM 5 +#define R92S_EVT_GET_BASICRATE 6 +#define R92S_EVT_GET_DATARATE 7 +#define R92S_EVT_SURVEY 8 +#define R92S_EVT_SURVEY_DONE 9 +#define R92S_EVT_JOIN_BSS 10 +#define R92S_EVT_ADD_STA 11 +#define R92S_EVT_DEL_STA 12 +#define R92S_EVT_ATIM_DONE 13 +#define R92S_EVT_TX_REPORT 14 +#define R92S_EVT_CCX_REPORT 15 +#define R92S_EVT_DTM_REPORT 16 +#define R92S_EVT_TXRATE_STATS 17 +#define R92S_EVT_C2H_LBK 18 +#define R92S_EVT_FWDBG 19 +#define R92S_EVT_C2H_FEEDBACK 20 +#define R92S_EVT_ADDBA 21 +#define R92S_EVT_C2H_BCN 22 +#define R92S_EVT_PWR_STATE 23 +#define R92S_EVT_WPS_PBC 24 +#define R92S_EVT_ADDBA_REQ_REPORT 25 /* Structure for R92S_CMD_SITE_SURVEY. */ struct r92s_fw_cmd_sitesurvey { @@ -541,52 +541,52 @@ struct r92s_rx_cck { /* Tx MAC descriptor. */ struct r92s_tx_desc { uint32_t txdw0; -#define R92S_TXDW0_PKTLEN_M 0x0000ffff -#define R92S_TXDW0_PKTLEN_S 0 -#define R92S_TXDW0_OFFSET_M 0x00ff0000 -#define R92S_TXDW0_OFFSET_S 16 -#define R92S_TXDW0_TYPE_M 0x03000000 -#define R92S_TXDW0_TYPE_S 24 -#define R92S_TXDW0_LSG 0x04000000 -#define R92S_TXDW0_FSG 0x08000000 -#define R92S_TXDW0_LINIP 0x10000000 -#define R92S_TXDW0_OWN 0x80000000 +#define R92S_TXDW0_PKTLEN_M 0x0000ffff +#define R92S_TXDW0_PKTLEN_S 0 +#define R92S_TXDW0_OFFSET_M 0x00ff0000 +#define R92S_TXDW0_OFFSET_S 16 +#define R92S_TXDW0_TYPE_M 0x03000000 +#define R92S_TXDW0_TYPE_S 24 +#define R92S_TXDW0_LSG 0x04000000 +#define R92S_TXDW0_FSG 0x08000000 +#define R92S_TXDW0_LINIP 0x10000000 +#define R92S_TXDW0_OWN 0x80000000 uint32_t txdw1; -#define R92S_TXDW1_MACID_M 0x0000001f -#define R92S_TXDW1_MACID_S 0 -#define R92S_TXDW1_MOREDATA 0x00000020 -#define R92S_TXDW1_MOREFRAG 0x00000040 -#define R92S_TXDW1_QSEL_M 0x00001f00 -#define R92S_TXDW1_QSEL_S 8 -#define R92S_TXDW1_QSEL_BE 0x03 -#define R92S_TXDW1_QSEL_H2C 0x1f -#define R92S_TXDW1_NONQOS 0x00010000 -#define R92S_TXDW1_KEYIDX_M 0x00060000 -#define R92S_TXDW1_KEYIDX_S 17 -#define R92S_TXDW1_CIPHER_M 0x00c00000 -#define R92S_TXDW1_CIPHER_S 22 -#define R92S_TXDW1_CIPHER_WEP 1 -#define R92S_TXDW1_CIPHER_TKIP 2 -#define R92S_TXDW1_CIPHER_AES 3 -#define R92S_TXDW1_HWPC 0x80000000 +#define R92S_TXDW1_MACID_M 0x0000001f +#define R92S_TXDW1_MACID_S 0 +#define R92S_TXDW1_MOREDATA 0x00000020 +#define R92S_TXDW1_MOREFRAG 0x00000040 +#define R92S_TXDW1_QSEL_M 0x00001f00 +#define R92S_TXDW1_QSEL_S 8 +#define R92S_TXDW1_QSEL_BE 0x03 +#define R92S_TXDW1_QSEL_H2C 0x1f +#define R92S_TXDW1_NONQOS 0x00010000 +#define R92S_TXDW1_KEYIDX_M 0x00060000 +#define R92S_TXDW1_KEYIDX_S 17 +#define R92S_TXDW1_CIPHER_M 0x00c00000 +#define R92S_TXDW1_CIPHER_S 22 +#define R92S_TXDW1_CIPHER_WEP 1 +#define R92S_TXDW1_CIPHER_TKIP 2 +#define R92S_TXDW1_CIPHER_AES 3 +#define R92S_TXDW1_HWPC 0x80000000 uint32_t txdw2; -#define R92S_TXDW2_BMCAST 0x00000080 -#define R92S_TXDW2_AGGEN 0x20000000 -#define R92S_TXDW2_BK 0x40000000 +#define R92S_TXDW2_BMCAST 0x00000080 +#define R92S_TXDW2_AGGEN 0x20000000 +#define R92S_TXDW2_BK 0x40000000 uint32_t txdw3; -#define R92S_TXDW3_SEQ_M 0x0fff0000 -#define R92S_TXDW3_SEQ_S 16 -#define R92S_TXDW3_FRAG_M 0xf0000000 -#define R92S_TXDW3_FRAG_S 28 +#define R92S_TXDW3_SEQ_M 0x0fff0000 +#define R92S_TXDW3_SEQ_S 16 +#define R92S_TXDW3_FRAG_M 0xf0000000 +#define R92S_TXDW3_FRAG_S 28 uint32_t txdw4; -#define R92S_TXDW4_TXBW 0x00040000 +#define R92S_TXDW4_TXBW 0x00040000 uint32_t txdw5; -#define R92S_TXDW5_DISFB 0x00008000 +#define R92S_TXDW5_DISFB 0x00008000 uint16_t ipchksum; uint16_t tcpchksum; @@ -599,8 +599,8 @@ struct r92s_tx_desc { /* * Driver definitions. */ -#define RSU_RX_LIST_COUNT 1 -#define RSU_TX_LIST_COUNT (8 + 1) /* NB: +1 for FW commands. */ +#define RSU_RX_LIST_COUNT 1 +#define RSU_TX_LIST_COUNT (8 + 1) /* NB: +1 for FW commands. */ #define RSU_HOST_CMD_RING_COUNT 32 |
