Date: Mon, 22 Feb 2010 08:43:27 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 174961 for review Message-ID: <201002220843.o1M8hReD039882@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=174961 Change 174961 by hselasky@hselasky_laptop001 on 2010/02/22 08:43:15 USB WLAN: - whitespace/style changes patch from Akinori. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/wlan/if_run.c#6 edit .. //depot/projects/usb/src/sys/dev/usb/wlan/if_runvar.h#5 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/wlan/if_run.c#6 (text+ko) ==== @@ -274,106 +274,110 @@ static usb_callback_t run_bulk_tx_callback4; static usb_callback_t run_bulk_tx_callback5; -static void run_bulk_tx_callbackN(struct usb_xfer *xfer, - usb_error_t error, unsigned int index); +static void run_bulk_tx_callbackN(struct usb_xfer *xfer, + usb_error_t error, unsigned int index); static struct ieee80211vap *run_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); -static void run_vap_delete(struct ieee80211vap *); -static void run_setup_tx_list(struct run_softc *sc, struct run_endpoint_queue *pq); -static void run_unsetup_tx_list(struct run_softc *sc, struct run_endpoint_queue *pq); -static int run_load_microcode(struct run_softc *); -static int run_reset(struct run_softc *); -static usb_error_t run_do_request(struct run_softc *sc, - struct usb_device_request *req, void *data); -static int run_read(struct run_softc *, uint16_t, uint32_t *); -static int run_read_region_1(struct run_softc *, uint16_t, uint8_t *, - int); -static int run_write_2(struct run_softc *, uint16_t, uint16_t); -static int run_write(struct run_softc *, uint16_t, uint32_t); -static int run_write_region_1(struct run_softc *, uint16_t, - const uint8_t *, int); -static int run_set_region_4(struct run_softc *, uint16_t, uint32_t, int); -static int run_efuse_read_2(struct run_softc *, uint16_t, uint16_t *); -static int run_eeprom_read_2(struct run_softc *, uint16_t, uint16_t *); -static int run_rt2870_rf_write(struct run_softc *, uint8_t, uint32_t); -static int run_rt3070_rf_read(struct run_softc *, uint8_t, uint8_t *); -static int run_rt3070_rf_write(struct run_softc *, uint8_t, uint8_t); -static int run_bbp_read(struct run_softc *, uint8_t, uint8_t *); -static int run_bbp_write(struct run_softc *, uint8_t, uint8_t); -static int run_mcu_cmd(struct run_softc *, uint8_t, uint16_t); -static const char * run_get_rf(int); -static int run_read_eeprom(struct run_softc *); + const char name[IFNAMSIZ], int unit, int opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t + mac[IEEE80211_ADDR_LEN]); +static void run_vap_delete(struct ieee80211vap *); +static void run_setup_tx_list(struct run_softc *, + struct run_endpoint_queue *); +static void run_unsetup_tx_list(struct run_softc *, + struct run_endpoint_queue *); +static int run_load_microcode(struct run_softc *); +static int run_reset(struct run_softc *); +static usb_error_t run_do_request(struct run_softc *, + struct usb_device_request *, void *); +static int run_read(struct run_softc *, uint16_t, uint32_t *); +static int run_read_region_1(struct run_softc *, uint16_t, uint8_t *, int); +static int run_write_2(struct run_softc *, uint16_t, uint16_t); +static int run_write(struct run_softc *, uint16_t, uint32_t); +static int run_write_region_1(struct run_softc *, uint16_t, + const uint8_t *, int); +static int run_set_region_4(struct run_softc *, uint16_t, uint32_t, int); +static int run_efuse_read_2(struct run_softc *, uint16_t, uint16_t *); +static int run_eeprom_read_2(struct run_softc *, uint16_t, uint16_t *); +static int run_rt2870_rf_write(struct run_softc *, uint8_t, uint32_t); +static int run_rt3070_rf_read(struct run_softc *, uint8_t, uint8_t *); +static int run_rt3070_rf_write(struct run_softc *, uint8_t, uint8_t); +static int run_bbp_read(struct run_softc *, uint8_t, uint8_t *); +static int run_bbp_write(struct run_softc *, uint8_t, uint8_t); +static int run_mcu_cmd(struct run_softc *, uint8_t, uint16_t); +static const char *run_get_rf(int); +static int run_read_eeprom(struct run_softc *); static struct ieee80211_node *run_node_alloc(struct ieee80211vap *, const uint8_t mac[IEEE80211_ADDR_LEN]); -static int run_media_change(struct ifnet *); -static int run_newstate(struct ieee80211vap *, enum ieee80211_state, int); -static int run_wme_update(struct ieee80211com *); -static void run_wme_update_cb(void *, int); -static void run_key_update_begin(struct ieee80211vap *); -static void run_key_update_end(struct ieee80211vap *); -static int run_key_set(struct ieee80211vap *, const struct ieee80211_key *, +static int run_media_change(struct ifnet *); +static int run_newstate(struct ieee80211vap *, enum ieee80211_state, int); +static int run_wme_update(struct ieee80211com *); +static void run_wme_update_cb(void *, int); +static void run_key_update_begin(struct ieee80211vap *); +static void run_key_update_end(struct ieee80211vap *); +static int run_key_set(struct ieee80211vap *, const struct ieee80211_key *, const uint8_t mac[IEEE80211_ADDR_LEN]); -static int run_key_delete(struct ieee80211vap *, const struct ieee80211_key *); -static void run_amrr_start(struct run_softc *, struct ieee80211_node *); -static void run_amrr_to(void *); -static void run_amrr_cb(void *, int); -static void run_iter_func(void *, struct ieee80211_node *); -static void run_newassoc(struct ieee80211_node *, int); -static void run_rx_frame(struct run_softc *, struct mbuf *, uint32_t); -static void run_tx_free(struct run_endpoint_queue *pq, struct run_tx_data *, int); -static void run_set_tx_desc(struct run_softc *, struct run_tx_data *, - uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t); -static int run_tx(struct run_softc *, struct mbuf *, - struct ieee80211_node *); -static int run_tx_mgt(struct run_softc *, struct mbuf *, struct ieee80211_node *); -static int run_sendprot(struct run_softc *, const struct mbuf *, - struct ieee80211_node *, int, int); -static int run_tx_param(struct run_softc *, struct mbuf *, - struct ieee80211_node *, const struct ieee80211_bpf_params *); -static int run_raw_xmit(struct ieee80211_node *, struct mbuf *, - const struct ieee80211_bpf_params *); -static void run_start(struct ifnet *); -static int run_ioctl(struct ifnet *, u_long, caddr_t); -static void run_select_chan_group(struct run_softc *, int); -static void run_set_rx_antenna(struct run_softc *, int); -static void run_rt2870_set_chan(struct run_softc *, u_int); -static void run_rt3070_set_chan(struct run_softc *, u_int); -static int run_set_chan(struct run_softc *, struct ieee80211_channel *); -static void run_set_agc(struct run_softc *, uint8_t); -static void run_set_channel(struct ieee80211com *); -static void run_scan_start(struct ieee80211com *); -static void run_scan_end(struct ieee80211com *); -static uint8_t run_rate2mcs(uint8_t rate); -static void run_rt3572_set_chan(struct run_softc *, u_int); -static void run_update_beacon(struct ieee80211vap *, int); -static void run_update_beacon_locked(struct ieee80211vap *, int); -static void run_updateprot(struct ieee80211com *ic); -static void run_usb_timeout_cb(void *, int); -static void run_reset_livelock(struct run_softc *); -static void run_enable_tsf_sync(struct run_softc *); -static void run_enable_mrr(struct run_softc *); -static void run_set_txpreamble(struct run_softc *); -static void run_set_basicrates(struct run_softc *); -static void run_set_leds(struct run_softc *, uint16_t); -static void run_set_bssid(struct run_softc *, const uint8_t *); -static void run_set_macaddr(struct run_softc *, const uint8_t *); -static void run_updateslot(struct ifnet *); -static void run_update_mcast(struct ifnet *); -static int8_t run_rssi2dbm(struct run_softc *, uint8_t, uint8_t); -static void run_update_promisc_locked(struct ifnet *); -static void run_update_promisc(struct ifnet *); -static int run_bbp_init(struct run_softc *); -static int run_rt3070_rf_init(struct run_softc *); -static int run_rt3070_filter_calib(struct run_softc *, uint8_t, uint8_t, - uint8_t *); -static int run_txrx_enable(struct run_softc *); -static void run_init(void *); -static void run_init_locked(struct run_softc *); -static void run_stop(void *); -static void run_rt3070_rf_setup(struct run_softc *); -static void run_delay(struct run_softc *, unsigned int); +static int run_key_delete(struct ieee80211vap *, + const struct ieee80211_key *); +static void run_amrr_start(struct run_softc *, struct ieee80211_node *); +static void run_amrr_to(void *); +static void run_amrr_cb(void *, int); +static void run_iter_func(void *, struct ieee80211_node *); +static void run_newassoc(struct ieee80211_node *, int); +static void run_rx_frame(struct run_softc *, struct mbuf *, uint32_t); +static void run_tx_free(struct run_endpoint_queue *pq, + struct run_tx_data *, int); +static void run_set_tx_desc(struct run_softc *, struct run_tx_data *, + uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t); +static int run_tx(struct run_softc *, struct mbuf *, + struct ieee80211_node *); +static int run_tx_mgt(struct run_softc *, struct mbuf *, + struct ieee80211_node *); +static int run_sendprot(struct run_softc *, const struct mbuf *, + struct ieee80211_node *, int, int); +static int run_tx_param(struct run_softc *, struct mbuf *, + struct ieee80211_node *, + const struct ieee80211_bpf_params *); +static int run_raw_xmit(struct ieee80211_node *, struct mbuf *, + const struct ieee80211_bpf_params *); +static void run_start(struct ifnet *); +static int run_ioctl(struct ifnet *, u_long, caddr_t); +static void run_set_agc(struct run_softc *, uint8_t); +static void run_select_chan_group(struct run_softc *, int); +static void run_set_rx_antenna(struct run_softc *, int); +static void run_rt2870_set_chan(struct run_softc *, u_int); +static void run_rt3070_set_chan(struct run_softc *, u_int); +static void run_rt3572_set_chan(struct run_softc *, u_int); +static int run_set_chan(struct run_softc *, struct ieee80211_channel *); +static void run_set_channel(struct ieee80211com *); +static void run_scan_start(struct ieee80211com *); +static void run_scan_end(struct ieee80211com *); +static uint8_t run_rate2mcs(uint8_t); +static void run_update_beacon(struct ieee80211vap *, int); +static void run_update_beacon_locked(struct ieee80211vap *, int); +static void run_updateprot(struct ieee80211com *); +static void run_usb_timeout_cb(void *, int); +static void run_reset_livelock(struct run_softc *); +static void run_enable_tsf_sync(struct run_softc *); +static void run_enable_mrr(struct run_softc *); +static void run_set_txpreamble(struct run_softc *); +static void run_set_basicrates(struct run_softc *); +static void run_set_leds(struct run_softc *, uint16_t); +static void run_set_bssid(struct run_softc *, const uint8_t *); +static void run_set_macaddr(struct run_softc *, const uint8_t *); +static void run_updateslot(struct ifnet *); +static int8_t run_rssi2dbm(struct run_softc *, uint8_t, uint8_t); +static void run_update_promisc_locked(struct ifnet *); +static void run_update_promisc(struct ifnet *); +static int run_bbp_init(struct run_softc *); +static int run_rt3070_rf_init(struct run_softc *); +static int run_rt3070_filter_calib(struct run_softc *, uint8_t, uint8_t, + uint8_t *); +static void run_rt3070_rf_setup(struct run_softc *); +static int run_txrx_enable(struct run_softc *); +static void run_init(void *); +static void run_init_locked(struct run_softc *); +static void run_stop(void *); +static void run_delay(struct run_softc *, unsigned int); static const struct { uint32_t reg; @@ -500,13 +504,13 @@ static int run_attach(device_t self) { - struct run_softc *sc = device_get_softc(self); - struct usb_attach_arg *uaa = device_get_ivars(self); - struct ieee80211com *ic; - struct ifnet *ifp; + struct run_softc *sc = device_get_softc(self); + struct usb_attach_arg *uaa = device_get_ivars(self); + struct ieee80211com *ic; + struct ifnet *ifp; uint32_t ver; - int i, ntries, error; - uint8_t iface_index, bands; + int i, ntries, error; + uint8_t iface_index, bands; device_set_usb_desc(self); sc->sc_udev = uaa->device; @@ -537,8 +541,8 @@ run_delay(sc, 10); } if (ntries == 100) { - printf("%s: timeout waiting for NIC to initialize\n", - device_get_nameunit(sc->sc_dev)); + device_printf(sc->sc_dev, + "timeout waiting for NIC to initialize\n"); RUN_UNLOCK(sc); goto detach; } @@ -548,14 +552,13 @@ /* retrieve RF rev. no and various other things from EEPROM */ run_read_eeprom(sc); - printf("%s: MAC/BBP RT%04X (rev 0x%04X), RF %s (MIMO %dT%dR), " - "address %s\n", device_get_nameunit(sc->sc_dev), sc->mac_ver, - sc->mac_rev, run_get_rf(sc->rf_rev), sc->ntxchains, - sc->nrxchains, ether_sprintf(sc->sc_bssid)); + device_printf(sc->sc_dev, + "MAC/BBP RT%04X (rev 0x%04X), RF %s (MIMO %dT%dR), address %s\n", + sc->mac_ver, sc->mac_rev, run_get_rf(sc->rf_rev), + sc->ntxchains, sc->nrxchains, ether_sprintf(sc->sc_bssid)); if ((error = run_load_microcode(sc)) != 0) { - printf("%s: could not load 8051 microcode\n", - device_get_nameunit(sc->sc_dev)); + device_printf(sc->sc_dev, "could not load 8051 microcode\n"); RUN_UNLOCK(sc); goto detach; } @@ -564,8 +567,7 @@ ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); if(ifp == NULL){ - printf("%s: can not if_alloc()\n", - device_get_nameunit(sc->sc_dev)); + device_printf(sc->sc_dev, "can not if_alloc()\n"); goto detach; } ic = ifp->if_l2com; @@ -637,7 +639,6 @@ ic->ic_set_channel = run_set_channel; ic->ic_node_alloc = run_node_alloc; ic->ic_newassoc = run_newassoc; - ic->ic_update_mcast = run_update_mcast; //ic->ic_updateslot = run_updateslot; ic->ic_wme.wme_update = run_wme_update; ic->ic_raw_xmit = run_raw_xmit; @@ -665,9 +666,9 @@ static int run_detach(device_t self) { - struct run_softc *sc = device_get_softc(self); - struct ifnet *ifp = sc->sc_ifp; - struct ieee80211com *ic; + struct run_softc *sc = device_get_softc(self); + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic; int i; /* stop all USB transfers */ @@ -696,9 +697,9 @@ const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t mac[IEEE80211_ADDR_LEN]) { - struct run_softc *sc = ic->ic_ifp->if_softc; - struct run_vap *rvp; - struct ieee80211vap *vap; + struct run_softc *sc = ic->ic_ifp->if_softc; + struct run_vap *rvp; + struct ieee80211vap *vap; if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */ return NULL; @@ -739,10 +740,10 @@ static void run_vap_delete(struct ieee80211vap *vap) { - struct run_vap *rvp = RUN_VAP(vap); - struct ifnet *ifp; - struct ieee80211com *ic; - struct run_softc *sc; + struct run_vap *rvp = RUN_VAP(vap); + struct ifnet *ifp; + struct ieee80211com *ic; + struct run_softc *sc; if(vap == NULL) return; @@ -809,21 +810,26 @@ int run_load_microcode(struct run_softc *sc) { - usb_device_request_t req; - const u_char *base; - uint32_t tmp; - int ntries, error; + usb_device_request_t req; + const struct firmware *fw; + const u_char *base; + uint32_t tmp; + int ntries, error; + const uint64_t *temp; + uint64_t bytes; - if((sc->fwp = firmware_get("runfw")) == NULL){ - printf("%s: failed loadfirmware of file %s (error %d)\n", - device_get_nameunit(sc->sc_dev), "runfw", ENOENT); + fw = firmware_get("runfw"); + if(fw == NULL){ + device_printf(sc->sc_dev, + "failed loadfirmware of file %s\n", "runfw"); return ENOENT; } - if (sc->fwp->datasize != 8192) { - printf("%s: invalid firmware size (should be 8KB)\n", - device_get_nameunit(sc->sc_dev)); - return EINVAL; + if (fw->datasize != 8192) { + device_printf(sc->sc_dev, + "invalid firmware size (should be 8KB)\n"); + error = EINVAL; + goto fail; } /* @@ -832,22 +838,23 @@ * first half (4KB) is for rt2870, * last half is for rt3071. */ - base = sc->fwp->data; + base = fw->data; if ((sc->mac_ver) != 0x2860 && (sc->mac_ver) != 0x2872 && (sc->mac_ver) != 0x3070){ base += 4096; - printf("%s: You are using firmware RT3071.\n", - device_get_nameunit(sc->sc_dev)); + device_printf(sc->sc_dev, "loading RT3071 firmware\n"); } else - printf("%s: You are using firmware RT2870.\n", - device_get_nameunit(sc->sc_dev)); + device_printf(sc->sc_dev, "loading RT2870 firmware\n"); /* cheap sanity check */ - const uint64_t *temp = sc->fwp->data; - uint64_t bytes = *temp; - if(bytes != be64toh(0xffffff0210280210)) - return EINVAL; + temp = fw->data; + bytes = *temp; + if(bytes != be64toh(0xffffff0210280210)) { + device_printf(sc->sc_dev, "firmware checksum failed\n"); + error = EINVAL; + goto fail; + } run_read(sc, RT2860_ASIC_VER_ID, &tmp); /* write microcode image */ @@ -860,31 +867,37 @@ USETW(req.wValue, 8); USETW(req.wIndex, 0); USETW(req.wLength, 0); - if ((error = usbd_do_request(sc->sc_udev, &sc->sc_mtx, &req, NULL)) != 0) - return error; + if ((error = usbd_do_request(sc->sc_udev, &sc->sc_mtx, &req, NULL)) != 0) { + device_printf(sc->sc_dev, "firmware reset failed\n"); + goto fail; + } run_delay(sc, 10); run_write(sc, RT2860_H2M_MAILBOX, 0); if ((error = run_mcu_cmd(sc, RT2860_MCU_CMD_RFRESET, 0)) != 0) - return error; + goto fail; /* wait until microcontroller is ready */ for (ntries = 0; ntries < 1000; ntries++) { - if ((error = run_read(sc, RT2860_SYS_CTRL, &tmp)) != 0) - return error; + if ((error = run_read(sc, RT2860_SYS_CTRL, &tmp)) != 0) { + goto fail; + } if (tmp & RT2860_MCU_READY) break; run_delay(sc, 10); } if (ntries == 1000) { - printf("%s: timeout waiting for MCU to initialize\n", - device_get_nameunit(sc->sc_dev)); - return ETIMEDOUT; + device_printf(sc->sc_dev, + "timeout waiting for MCU to initialize\n"); + error = ETIMEDOUT; + goto fail; } DPRINTF("microcode successfully loaded after %d tries\n", ntries); - return 0; +fail: + firmware_put(fw, FIRMWARE_UNLOAD); + return (error); } int @@ -1272,10 +1285,10 @@ int run_read_eeprom(struct run_softc *sc) { - int8_t delta_2ghz, delta_5ghz; - uint32_t tmp; - uint16_t val; - int ridx, ant, i; + int8_t delta_2ghz, delta_5ghz; + uint32_t tmp; + uint16_t val; + int ridx, ant, i; /* check whether the ROM is eFUSE ROM or EEPROM */ sc->sc_srom_read = run_eeprom_read_2; @@ -1324,7 +1337,7 @@ sc->freq = ((val & 0xff) != 0xff) ? val & 0xff : 0; DPRINTF("EEPROM freq offset %d\n", sc->freq & 0xff); - if ((val >> 8) != 0xff) { + if (val >> 8 != 0xff) { /* read LEDs operating mode */ sc->leds = val >> 8; run_srom_read(sc, RT2860_EEPROM_LED1, &sc->led[0]); @@ -1528,12 +1541,12 @@ static int run_media_change(struct ifnet *ifp) { - const struct ieee80211_txparam *tp; - struct run_softc *sc = ifp->if_softc; - struct ieee80211com *ic = sc->sc_ifp->if_l2com; - struct ieee80211vap *vap = &sc->sc_rvp->vap; - uint8_t rate, ridx; - int error; + const struct ieee80211_txparam *tp; + struct run_softc *sc = ifp->if_softc; + struct ieee80211com *ic = sc->sc_ifp->if_l2com; + struct ieee80211vap *vap = &sc->sc_rvp->vap; + uint8_t rate, ridx; + int error; RUN_LOCK(sc); @@ -1565,14 +1578,14 @@ static int run_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) { - const struct ieee80211_txparam *tp; - struct ieee80211com *ic = vap->iv_ic; - struct run_softc *sc = ic->ic_ifp->if_softc; - struct run_vap *rvp = RUN_VAP(vap); - enum ieee80211_state ostate; - struct ieee80211_node *ni; - uint32_t tmp; - uint8_t wcid; + const struct ieee80211_txparam *tp; + struct ieee80211com *ic = vap->iv_ic; + struct run_softc *sc = ic->ic_ifp->if_softc; + struct run_vap *rvp = RUN_VAP(vap); + enum ieee80211_state ostate; + struct ieee80211_node *ni; + uint32_t tmp; + uint8_t wcid; ostate = vap->iv_state; DPRINTF("%s -> %s\n", @@ -1654,7 +1667,7 @@ static int run_wme_update(struct ieee80211com *ic) { - struct run_softc *sc = ic->ic_ifp->if_softc; + struct run_softc *sc = ic->ic_ifp->if_softc; ieee80211_runtask(ic, &sc->wme_task); @@ -1666,9 +1679,9 @@ static void run_wme_update_cb(void *arg, int pending) { - struct ieee80211com *ic = arg; - struct run_softc *sc = ic->ic_ifp->if_softc; - struct ieee80211_wme_state *wmesp = &ic->ic_wme; + struct ieee80211com *ic = arg; + struct run_softc *sc = ic->ic_ifp->if_softc; + struct ieee80211_wme_state *wmesp = &ic->ic_wme; int aci, error = 0; RUN_LOCK(sc); @@ -1743,14 +1756,14 @@ run_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, const uint8_t mac[IEEE80211_ADDR_LEN]) { - struct ieee80211com *ic = vap->iv_ic; - struct ifnet *ifp = ic->ic_ifp; - struct run_softc *sc = ifp->if_softc; - struct ieee80211_node *ni; - uint32_t attr; - uint16_t base, associd; - uint8_t mode, wcid, txmic, rxmic, iv[8]; - int error = 0; + struct ieee80211com *ic = vap->iv_ic; + struct ifnet *ifp = ic->ic_ifp; + struct run_softc *sc = ifp->if_softc; + struct ieee80211_node *ni; + uint32_t attr; + uint16_t base, associd; + uint8_t mode, wcid, txmic, rxmic, iv[8]; + int error = 0; RUN_LOCK(sc); @@ -1868,14 +1881,14 @@ static int run_key_delete(struct ieee80211vap *vap, const struct ieee80211_key *k) { - struct ieee80211com *ic = vap->iv_ic; - struct run_softc *sc = ic->ic_ifp->if_softc; - struct ieee80211_node *ni = vap->iv_bss; - struct ieee80211_node_table *nt = &ic->ic_sta; + struct ieee80211com *ic = vap->iv_ic; + struct run_softc *sc = ic->ic_ifp->if_softc; + struct ieee80211_node *ni = vap->iv_bss; + struct ieee80211_node_table *nt = &ic->ic_sta; uint32_t attr; uint8_t wcid; - int error = 0; - uint8_t nislocked, cislocked; + int error = 0; + uint8_t nislocked, cislocked; if((nislocked = IEEE80211_NODE_IS_LOCKED(nt))) IEEE80211_NODE_UNLOCK(nt); @@ -1913,10 +1926,10 @@ static void run_amrr_start(struct run_softc *sc, struct ieee80211_node *ni) { - struct ieee80211vap *vap = ni->ni_vap; - struct run_vap *rvp = RUN_VAP(vap); - uint32_t sta[3]; - uint8_t wcid; + struct ieee80211vap *vap = ni->ni_vap; + struct run_vap *rvp = RUN_VAP(vap); + uint32_t sta[3]; + uint8_t wcid; RUN_LOCK_ASSERT(sc, MA_OWNED); @@ -1938,7 +1951,7 @@ static void run_amrr_to(void *arg) { - struct run_vap *rvp = arg; + struct run_vap *rvp = arg; /* do it in a process context, so it can go sleep */ ieee80211_runtask(rvp->vap.iv_ic, &rvp->amrr_task); @@ -1949,10 +1962,10 @@ static void run_amrr_cb(void *arg, int pending) { - struct run_vap *rvp = arg; - struct ieee80211vap *vap = &rvp->vap; - struct ieee80211com *ic = vap->iv_ic; - struct run_softc *sc = ic->ic_ifp->if_softc; + struct run_vap *rvp = arg; + struct ieee80211vap *vap = &rvp->vap; + struct ieee80211com *ic = vap->iv_ic; + struct run_softc *sc = ic->ic_ifp->if_softc; if (ic->ic_opmode == IEEE80211_M_STA) run_iter_func(rvp, vap->iv_bss); @@ -1978,15 +1991,15 @@ static void run_iter_func(void *arg, struct ieee80211_node *ni) { - struct run_vap *rvp = arg; - struct ieee80211com *ic = rvp->vap.iv_ic; - struct ifnet *ifp = ic->ic_ifp; - struct run_softc *sc = ifp->if_softc; - struct ieee80211_node_table *nt = &ic->ic_sta; - struct ieee80211_amrr_node *amn = &rvp->amn[0]; /* make compiler happy */ - uint32_t sta[3], stat; - int error; - uint8_t wcid, mcs, pid; + struct run_vap *rvp = arg; + struct ieee80211com *ic = rvp->vap.iv_ic; + struct ifnet *ifp = ic->ic_ifp; + struct run_softc *sc = ifp->if_softc; + struct ieee80211_node_table *nt = &ic->ic_sta; + struct ieee80211_amrr_node *amn = &rvp->amn[0]; /* make compiler happy */ + uint32_t sta[3], stat; + int error; + uint8_t wcid, mcs, pid; if(ic->ic_opmode != IEEE80211_M_STA) IEEE80211_NODE_ITERATE_UNLOCK(nt); @@ -2011,11 +2024,11 @@ if (stat & RT2860_TXQ_OK) { amn->amn_success++; /* - * Check if there were retries, ie if the Tx success - * rate is different from the requested rate. Note - * that it works only because we do not allow rate - * fallback from OFDM to CCK. - */ + * Check if there were retries, ie if the Tx + * success rate is different from the requested + * rate. Note that it works only because we do + * not allow rate fallback from OFDM to CCK. + */ mcs = (stat >> RT2860_TXQ_MCS_SHIFT) & 0x7f; pid = (stat >> RT2860_TXQ_PID_SHIFT) & 0xf; if (mcs + 1 != pid) @@ -2024,7 +2037,8 @@ amn->amn_retrycnt++; ifp->if_oerrors++; } - run_read_region_1(sc, RT2860_TX_STAT_FIFO, (uint8_t *)&stat, sizeof stat); + run_read_region_1(sc, RT2860_TX_STAT_FIFO, + (uint8_t *)&stat, sizeof stat); } DPRINTFN(3, "retrycnt=%d txcnt=%d success=%d\n", amn->amn_retrycnt, amn->amn_txcnt, amn->amn_success); @@ -2070,10 +2084,10 @@ static void run_newassoc(struct ieee80211_node *ni, int isnew) { - struct run_node *rn = (void *)ni; - struct ieee80211_rateset *rs = &ni->ni_rates; - uint8_t rate; - int ridx, i, j; + struct run_node *rn = (void *)ni; + struct ieee80211_rateset *rs = &ni->ni_rates; + uint8_t rate; + int ridx, i, j; DPRINTF("new assoc isnew=%d addr=%s\n", isnew, ether_sprintf(ni->ni_macaddr)); @@ -2124,17 +2138,17 @@ static void run_rx_frame(struct run_softc *sc, struct mbuf *m, uint32_t dmalen) { - struct ifnet *ifp = sc->sc_ifp; - struct ieee80211vap *vap = &sc->sc_rvp->vap; - struct ieee80211com *ic = ifp->if_l2com; - struct ieee80211_frame *wh; - struct ieee80211_node *ni; - struct rt2870_rxd *rxd; - struct rt2860_rxwi *rxwi; - uint32_t flags; - uint16_t len, phy; - uint8_t ant, rssi; - int8_t nf; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211vap *vap = &sc->sc_rvp->vap; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211_frame *wh; + struct ieee80211_node *ni; + struct rt2870_rxd *rxd; + struct rt2860_rxwi *rxwi; + uint32_t flags; + uint16_t len, phy; + uint8_t ant, rssi; + int8_t nf; rxwi = mtod(m, struct rt2860_rxwi *); len = le16toh(rxwi->len) & 0xfff; @@ -2236,12 +2250,12 @@ static void run_bulk_rx_callback(struct usb_xfer *xfer, usb_error_t error) { - struct run_softc *sc = usbd_xfer_softc(xfer); - struct ifnet *ifp = sc->sc_ifp; - struct mbuf *m = NULL; - struct mbuf *m0; - uint32_t dmalen; - int xferlen; + struct run_softc *sc = usbd_xfer_softc(xfer); + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m = NULL; + struct mbuf *m0; + uint32_t dmalen; + int xferlen; usbd_xfer_status(xfer, &xferlen, NULL, NULL, NULL); @@ -2382,17 +2396,17 @@ static void run_bulk_tx_callbackN(struct usb_xfer *xfer, usb_error_t error, unsigned int index) { - struct run_softc *sc = usbd_xfer_softc(xfer); - struct ifnet *ifp = sc->sc_ifp; - struct run_tx_data *data; - struct ieee80211vap *vap = NULL; - struct usb_page_cache *pc; + struct run_softc *sc = usbd_xfer_softc(xfer); + struct ifnet *ifp = sc->sc_ifp; + struct run_tx_data *data; + struct ieee80211vap *vap = NULL; + struct usb_page_cache *pc; struct run_endpoint_queue *pq = &sc->sc_epq[index]; - struct mbuf *m; - usb_frlength_t size; - unsigned int len; - int actlen; - int sumlen; + struct mbuf *m; + usb_frlength_t size; + unsigned int len; + int actlen; + int sumlen; usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); @@ -2540,14 +2554,14 @@ uint8_t wflags, uint8_t xflags, uint8_t opflags, uint8_t dflags, uint8_t type, uint8_t pad) { - struct mbuf *m = data->m; - struct ieee80211com *ic = sc->sc_ifp->if_l2com; - struct ieee80211vap *vap = &sc->sc_rvp->vap; - struct ieee80211_frame *wh; - struct rt2870_txd *txd; - struct rt2860_txwi *txwi; - int xferlen; - uint8_t mcs; + struct mbuf *m = data->m; + struct ieee80211com *ic = sc->sc_ifp->if_l2com; + struct ieee80211vap *vap = &sc->sc_rvp->vap; + struct ieee80211_frame *wh; + struct rt2870_txd *txd; + struct rt2860_txwi *txwi; + int xferlen; + uint8_t mcs; uint8_t ridx = data->ridx; /* get MCS code from rate index */ @@ -2594,22 +2608,22 @@ static int run_tx(struct run_softc *sc, struct mbuf *m, struct ieee80211_node *ni) { - struct ieee80211com *ic = sc->sc_ifp->if_l2com; - struct ieee80211vap *vap = &sc->sc_rvp->vap; - struct ieee80211_frame *wh; - const struct ieee80211_txparam *tp; - struct run_tx_data *data; - uint16_t qos; - uint16_t dur; - uint8_t type; - uint8_t tid; - uint8_t qid; - uint8_t qflags; - uint8_t pad; - uint8_t xflags = 0; - int hasqos; - int ridx; - int ctl_ridx; + struct ieee80211com *ic = sc->sc_ifp->if_l2com; + struct ieee80211vap *vap = &sc->sc_rvp->vap; + struct ieee80211_frame *wh; + const struct ieee80211_txparam *tp; + struct run_tx_data *data; + uint16_t qos; + uint16_t dur; + uint8_t type; + uint8_t tid; + uint8_t qid; + uint8_t qflags; + uint8_t pad; + uint8_t xflags = 0; + int hasqos; + int ridx; + int ctl_ridx; RUN_LOCK_ASSERT(sc, MA_OWNED); @@ -2624,7 +2638,7 @@ * seem to have only 4 TX bulk endpoints (Fukaumi Naoki). */ if ((hasqos = IEEE80211_QOS_HAS_SEQ(wh))) { - uint8_t *frm; + uint8_t *frm; if(IEEE80211_HAS_ADDR4(wh)) frm = ((struct ieee80211_qosframe_addr4 *)wh)->i_qos; @@ -2706,16 +2720,16 @@ static int run_tx_mgt(struct run_softc *sc, struct mbuf *m, struct ieee80211_node *ni) { - const struct ieee80211_txparam *tp; - struct ifnet *ifp = sc->sc_ifp; - struct ieee80211vap *vap = ni->ni_vap; - struct ieee80211com *ic = ifp->if_l2com; - struct run_tx_data *data; - struct ieee80211_frame *wh; - int ridx; - uint16_t dur; - uint8_t type; - uint8_t xflags = 0; + const struct ieee80211_txparam *tp; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211com *ic = ifp->if_l2com; + struct run_tx_data *data; + struct ieee80211_frame *wh; + int ridx; + uint16_t dur; + uint8_t type; + uint8_t xflags = 0; RUN_LOCK_ASSERT(sc, MA_OWNED); @@ -2772,19 +2786,19 @@ run_sendprot(struct run_softc *sc, const struct mbuf *m, struct ieee80211_node *ni, int prot, int rate) { - struct ieee80211com *ic = ni->ni_ic; - struct ieee80211_frame *wh; - struct run_tx_data *data; - struct mbuf *mprot; - int ridx; - int protrate; - int ackrate; - int pktlen; - int isshort; - uint16_t dur; - uint8_t type; - uint8_t wflags; - uint8_t txflags = 0; + struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_frame *wh; + struct run_tx_data *data; + struct mbuf *mprot; + int ridx; + int protrate; + int ackrate; + int pktlen; + int isshort; + uint16_t dur; + uint8_t type; + uint8_t wflags; + uint8_t txflags = 0; RUN_LOCK_ASSERT(sc, MA_OWNED); @@ -2853,15 +2867,15 @@ run_tx_param(struct run_softc *sc, struct mbuf *m, struct ieee80211_node *ni, const struct ieee80211_bpf_params *params) { - struct ieee80211com *ic = ni->ni_ic; - struct ieee80211_frame *wh; - struct run_tx_data *data; - uint8_t type; - uint8_t opflags; - uint8_t txflags; - int ridx; - int rate; - int error; + struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_frame *wh; + struct run_tx_data *data; + uint8_t type; + uint8_t opflags; + uint8_t txflags; + int ridx; + int rate; + int error; RUN_LOCK_ASSERT(sc, MA_OWNED); @@ -2926,9 +2940,9 @@ run_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, const struct ieee80211_bpf_params *params) { - struct ifnet *ifp = ni->ni_ic->ic_ifp; - struct run_softc *sc = ifp->if_softc; - int error; + struct ifnet *ifp = ni->ni_ic->ic_ifp; + struct run_softc *sc = ifp->if_softc; + int error; RUN_LOCK(sc); @@ -2972,9 +2986,9 @@ static void run_start(struct ifnet *ifp) { - struct run_softc *sc = ifp->if_softc; - struct ieee80211_node *ni; - struct mbuf *m; + struct run_softc *sc = ifp->if_softc; + struct ieee80211_node *ni; + struct mbuf *m; RUN_LOCK(sc); @@ -3003,10 +3017,10 @@ static int run_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - struct run_softc *sc = ifp->if_softc; - struct ieee80211com *ic = sc->sc_ifp->if_l2com; - struct ifreq *ifr = (struct ifreq *) data; - int error = 0, startall = 0; + struct run_softc *sc = ifp->if_softc; + struct ieee80211com *ic = sc->sc_ifp->if_l2com; + struct ifreq *ifr = (struct ifreq *) data; + int error = 0, startall = 0; switch (cmd) { case SIOCSIFFLAGS: @@ -3449,7 +3463,7 @@ static void run_set_channel(struct ieee80211com *ic) { - struct run_softc *sc = ic->ic_ifp->if_softc; + struct run_softc *sc = ic->ic_ifp->if_softc; RUN_LOCK(sc); run_set_chan(sc, ic->ic_curchan); @@ -3461,8 +3475,8 @@ static void run_scan_start(struct ieee80211com *ic) { - struct run_softc *sc = ic->ic_ifp->if_softc; - uint32_t tmp; + struct run_softc *sc = ic->ic_ifp->if_softc; + uint32_t tmp; RUN_LOCK(sc); @@ -3481,7 +3495,7 @@ static void run_scan_end(struct ieee80211com *ic) { - struct run_softc *sc = ic->ic_ifp->if_softc; + struct run_softc *sc = ic->ic_ifp->if_softc; RUN_LOCK(sc); @@ -3519,11 +3533,11 @@ static void run_update_beacon_locked(struct ieee80211vap *vap, int item) { - struct ieee80211com *ic = vap->iv_ic; - struct run_softc *sc = ic->ic_ifp->if_softc; - struct rt2860_txwi txwi; - struct mbuf *m; - int rate; + struct ieee80211com *ic = vap->iv_ic; >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002220843.o1M8hReD039882>