Lines Matching defs:ic

115 ieee80211_mac_update(ieee80211com_t *ic)
124 in = ic->ic_bss;
125 wd.wd_secalloc = ieee80211_crypto_getciphertype(ic);
126 wd.wd_opmode = ic->ic_opmode;
131 if (ic->ic_flags & IEEE80211_F_DATAPAD)
134 (void) mac_pdata_update(ic->ic_mach, &wd, sizeof (wd));
135 mac_tx_update(ic->ic_mach);
147 ieee80211com_t *ic = arg;
152 mutex_enter(&ic->ic_doorlock);
154 ev.event = ic->ic_eventq[ic->ic_evq_head];
155 ic->ic_evq_head ++;
156 if (ic->ic_evq_head >= MAX_EVENT)
157 ic->ic_evq_head = 0;
163 if (door_ki_open(ic->ic_wpadoor, &event_door) != 0) {
165 ic->ic_wpadoor);
185 mutex_exit(&ic->ic_doorlock);
192 ieee80211_notify(ieee80211com_t *ic, wpa_event_type event)
194 if ((ic->ic_flags & IEEE80211_F_WPA) == 0)
197 ic->ic_eventq[ic->ic_evq_tail] = event;
198 ic->ic_evq_tail ++;
199 if (ic->ic_evq_tail >= MAX_EVENT) ic->ic_evq_tail = 0;
202 (void) timeout(ieee80211_event_thread, (void *)ic, 0);
209 ieee80211_register_door(ieee80211com_t *ic, const char *drvname, int inst)
211 (void) snprintf(ic->ic_wpadoor, MAX_IEEE80211STR, "%s_%s%d",
226 ieee80211_default_reset(ieee80211com_t *ic)
235 ieee80211_chan2ieee(ieee80211com_t *ic, struct ieee80211_channel *ch)
237 if ((ic->ic_sup_channels <= ch) &&
238 (ch <= &ic->ic_sup_channels[IEEE80211_CHAN_MAX])) {
239 return (ch - ic->ic_sup_channels);
296 ieee80211_media_init(ieee80211com_t *ic)
302 ieee80211_node_lateattach(ic);
310 ieee80211_start_watchdog(ieee80211com_t *ic, uint32_t timer)
312 if (ic->ic_watchdog_timer == 0 && ic->ic_watchdog != NULL) {
313 ic->ic_watchdog_timer = timeout(ic->ic_watchdog, ic,
322 ieee80211_stop_watchdog(ieee80211com_t *ic)
324 if (ic->ic_watchdog_timer != 0) {
325 if (ic->ic_watchdog != NULL)
326 (void) untimeout(ic->ic_watchdog_timer);
327 ic->ic_watchdog_timer = 0;
339 ieee80211com_t *ic = arg;
340 struct ieee80211_impl *im = ic->ic_private;
344 if (ic->ic_state == IEEE80211_S_INIT)
347 IEEE80211_LOCK(ic);
349 IEEE80211_UNLOCK(ic);
350 ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
351 IEEE80211_LOCK(ic);
354 nt = &ic->ic_scan;
360 nt = &ic->ic_sta;
367 IEEE80211_UNLOCK(ic);
370 ieee80211_start_watchdog(ic, 1);
382 ieee80211_setmode(ieee80211com_t *ic, enum ieee80211_phymode mode)
402 if ((ic->ic_modecaps & (1 << mode)) == 0) {
404 " (caps 0x%x)\n", mode, ic->ic_modecaps);
415 bzero(ic->ic_chan_active, sizeof (ic->ic_chan_active));
417 ch = &ic->ic_sup_channels[i];
423 ieee80211_setbit(ic->ic_chan_active, i);
428 ieee80211_setbit(ic->ic_chan_active, i);
445 if (ic->ic_ibss_chan == NULL ||
446 ieee80211_isclr(ic->ic_chan_active,
447 ieee80211_chan2ieee(ic, ic->ic_ibss_chan))) {
449 if (ieee80211_isset(ic->ic_chan_active, i)) {
450 ic->ic_ibss_chan = &ic->ic_sup_channels[i];
458 if (ic->ic_des_chan != IEEE80211_CHAN_ANYC &&
459 ieee80211_isclr(ic->ic_chan_active,
460 ieee80211_chan2ieee(ic, ic->ic_des_chan))) {
461 ic->ic_des_chan = IEEE80211_CHAN_ANYC;
468 ieee80211_setbasicrates(&ic->ic_sup_rates[mode], mode);
476 if (ic->ic_bss != NULL)
477 ic->ic_bss->in_rates = ic->ic_sup_rates[mode];
478 ic->ic_curmode = mode;
479 ieee80211_reset_erp(ic); /* reset ERP state */
480 ieee80211_wme_initparams(ic); /* reset WME stat */
493 ieee80211_chan2mode(ieee80211com_t *ic, struct ieee80211_channel *chan)
522 ieee80211_get_suprates(ieee80211com_t *ic, struct ieee80211_channel *c)
525 return (&ic->ic_sup_rates[IEEE80211_MODE_11A]);
527 return (&ic->ic_sup_rates[IEEE80211_MODE_11G]);
529 return (&ic->ic_sup_rates[ieee80211_chan2mode(ic, c)]);
538 ieee80211_find_channel(ieee80211com_t *ic, int freq, int flags)
546 c = &ic->ic_sup_channels[i];
580 ieee80211_hdrspace(ieee80211com_t *ic, const void *data)
583 if (ic->ic_flags & IEEE80211_F_DATAPAD)
613 ieee80211_anyhdrspace(ieee80211com_t *ic, const void *data)
616 if (ic->ic_flags & IEEE80211_F_DATAPAD)
651 ieee80211_notify_node_join(ieee80211com_t *ic, ieee80211_node_t *in)
653 if (in == ic->ic_bss)
654 mac_link_update(ic->ic_mach, LINK_STATE_UP);
655 ieee80211_notify(ic, EVENT_ASSOC); /* notify WPA service */
664 ieee80211_notify_node_leave(ieee80211com_t *ic, ieee80211_node_t *in)
666 if (in == ic->ic_bss)
667 mac_link_update(ic->ic_mach, LINK_STATE_DOWN);
668 ieee80211_notify(ic, EVENT_DISASSOC); /* notify WPA service */
678 ieee80211_stat(ieee80211com_t *ic, uint_t stat, uint64_t *val)
681 IEEE80211_LOCK(ic);
684 *val = ic->ic_stats.is_tx_frags;
687 *val = ic->ic_stats.is_tx_mcast;
690 *val = ic->ic_stats.is_tx_failed;
693 *val = ic->ic_stats.is_tx_retries;
696 *val = ic->ic_stats.is_rts_success;
699 *val = ic->ic_stats.is_rts_failure;
702 *val = ic->ic_stats.is_ack_failure;
705 *val = ic->ic_stats.is_rx_frags;
708 *val = ic->ic_stats.is_rx_mcast;
711 *val = ic->ic_stats.is_rx_dups;
714 *val = ic->ic_stats.is_fcs_errors;
717 *val = ic->ic_stats.is_wep_errors;
720 IEEE80211_UNLOCK(ic);
727 * functionss. The parameter "ic" MUST be initialized to tell
731 ieee80211_attach(ieee80211com_t *ic)
738 ASSERT(ic->ic_xmit != NULL);
740 mutex_init(&ic->ic_genlock, NULL, MUTEX_DRIVER, NULL);
741 mutex_init(&ic->ic_doorlock, NULL, MUTEX_DRIVER, NULL);
744 ic->ic_private = im;
753 ic->ic_modecaps |= 1 << IEEE80211_MODE_AUTO;
755 ch = &ic->ic_sup_channels[i];
758 if (i != ieee80211_chan2ieee(ic, ch)) {
768 ic->ic_modecaps |= 1 << IEEE80211_MODE_11A;
770 ic->ic_modecaps |= 1 << IEEE80211_MODE_11B;
772 ic->ic_modecaps |= 1 << IEEE80211_MODE_11G;
774 ic->ic_modecaps |= 1 << IEEE80211_MODE_FH;
776 ic->ic_modecaps |= 1 << IEEE80211_MODE_TURBO_A;
778 ic->ic_modecaps |= 1 << IEEE80211_MODE_TURBO_G;
780 ic->ic_modecaps |= 1 << IEEE80211_MODE_STURBO_A;
782 ic->ic_modecaps |= 1 << IEEE80211_MODE_11NA;
784 ic->ic_modecaps |= 1 << IEEE80211_MODE_11NG;
785 if (ic->ic_curchan == NULL) {
787 ic->ic_curchan = &ic->ic_sup_channels[i];
791 /* validate ic->ic_curmode */
792 if ((ic->ic_modecaps & (1 << ic->ic_curmode)) == 0)
793 ic->ic_curmode = IEEE80211_MODE_AUTO;
794 ic->ic_des_chan = IEEE80211_CHAN_ANYC; /* any channel is ok */
795 (void) ieee80211_setmode(ic, ic->ic_curmode);
797 if (ic->ic_caps & IEEE80211_C_WME) /* enable if capable */
798 ic->ic_flags |= IEEE80211_F_WME;
799 if (ic->ic_caps & IEEE80211_C_BURST)
800 ic->ic_flags |= IEEE80211_F_BURST;
801 ic->ic_bintval = IEEE80211_BINTVAL_DEFAULT;
802 ic->ic_lintval = ic->ic_bintval;
803 ic->ic_txpowlimit = IEEE80211_TXPOWER_MAX;
804 ic->ic_bmissthreshold = IEEE80211_HWBMISS_DEFAULT;
806 ic->ic_reset = ieee80211_default_reset;
808 ieee80211_node_attach(ic);
809 ieee80211_proto_attach(ic);
810 ieee80211_crypto_attach(ic);
811 ieee80211_ht_attach(ic);
813 ic->ic_watchdog_timer = 0;
820 ieee80211_detach(ieee80211com_t *ic)
822 struct ieee80211_impl *im = ic->ic_private;
824 ieee80211_stop_watchdog(ic);
828 if (ic->ic_opt_ie != NULL)
829 ieee80211_free(ic->ic_opt_ie);
831 ieee80211_ht_detach(ic);
832 ieee80211_node_detach(ic);
833 ieee80211_crypto_detach(ic);
835 mutex_destroy(&ic->ic_genlock);
836 mutex_destroy(&ic->ic_doorlock);