Mercurial > illumos > illumos-gate
changeset 10509:d591364f8732 onnv_124
6875395 iwk doesn't support IBSS in snv_121
author | fei feng - Sun Microsystems - Beijing China <Fei.Feng@Sun.COM> |
---|---|
date | Sun, 13 Sep 2009 17:46:50 +0800 |
parents | d2c22be61f37 |
children | ac4291bea6be |
files | usr/src/uts/common/io/net80211/net80211_ioctl.c |
diffstat | 1 files changed, 57 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/io/net80211/net80211_ioctl.c Sat Sep 12 21:28:13 2009 -0400 +++ b/usr/src/uts/common/io/net80211/net80211_ioctl.c Sun Sep 13 17:46:50 2009 +0800 @@ -72,6 +72,8 @@ static int wl_set_mlme(struct ieee80211com *, const void *); static int wl_set_wpakey(struct ieee80211com *, const void *); static void wl_get_suprates(struct ieee80211com *, void *); +static int wl_set_createibss(struct ieee80211com *, const void *); +static void wl_get_createibss(struct ieee80211com *, void *); static size_t wifi_strnlen(const char *s, size_t n) @@ -496,34 +498,10 @@ switch (cmd) { case WLAN_GET_PARAM: - *ow_ibss = (ic->ic_flags & IEEE80211_F_IBSSON) ? 1 : 0; + wl_get_createibss(ic, ow_ibss); break; case WLAN_SET_PARAM: - ieee80211_dbg(IEEE80211_MSG_CONFIG, "wifi_cfg_createibss: " - "set createibss=%u\n", *iw_ibss); - if ((ic->ic_caps & IEEE80211_C_IBSS) == 0) { - outp->wldp_result = WL_LACK_FEATURE; - err = ENOTSUP; - break; - } - if (*iw_ibss) { /* create ibss */ - if ((ic->ic_flags & IEEE80211_F_IBSSON) == 0) { - ic->ic_flags |= IEEE80211_F_IBSSON; - ic->ic_opmode = IEEE80211_M_IBSS; - /* - * Yech, slot time may change depending on the - * operating mode so reset it to be sure - * everything is setup appropriately. - */ - ieee80211_reset_erp(ic); - err = ENETRESET; - } - } else { - if (ic->ic_flags & IEEE80211_F_IBSSON) { - ic->ic_flags &= ~IEEE80211_F_IBSSON; - err = ENETRESET; - } - } + err = wl_set_createibss(ic, iw_ibss); break; default: ieee80211_err("wifi_cfg_bsstype: unknown command %x\n", cmd); @@ -2342,6 +2320,52 @@ } /* + * MAC_PROP_WL_CREATE_IBSS + */ +static int +wl_set_createibss(struct ieee80211com *ic, const void *wldp_buf) +{ + wl_create_ibss_t *iw_ibss = (wl_create_ibss_t *)wldp_buf; + int err = 0; + + ieee80211_dbg(IEEE80211_MSG_CONFIG, "wl_set_ibss: " + "set createibss=%u\n", *iw_ibss); + + if ((ic->ic_caps & IEEE80211_C_IBSS) == 0) { + err = ENOTSUP; + return (err); + } + if (*iw_ibss) { + if ((ic->ic_flags & IEEE80211_F_IBSSON) == 0) { + ic->ic_flags |= IEEE80211_F_IBSSON; + ic->ic_opmode = IEEE80211_M_IBSS; + /* + * Yech, slot time may change depending on the + * operating mode so reset it to be sure + * everything is setup appropriately. + */ + ieee80211_reset_erp(ic); + err = ENETRESET; + } + } else { + if (ic->ic_flags & IEEE80211_F_IBSSON) { + ic->ic_flags &= ~IEEE80211_F_IBSSON; + err = ENETRESET; + } + } + + return (err); +} + +static void +wl_get_createibss(struct ieee80211com *ic, void *wldp_buf) +{ + wl_create_ibss_t *ow_ibss = (wl_create_ibss_t *)wldp_buf; + + *ow_ibss = (ic->ic_flags & IEEE80211_F_IBSSON)? 1 : 0; +} + +/* * Typically invoked by drivers in response to request for * information or to change settings from the userland. * @@ -2407,6 +2431,9 @@ case MAC_PROP_WL_MLME: err = wl_set_mlme(ic, wldp_buf); break; + case MAC_PROP_WL_CREATE_IBSS: + err = wl_set_createibss(ic, wldp_buf); + break; case MAC_PROP_WL_LINKSTATUS: case MAC_PROP_WL_ESS_LIST: case MAC_PROP_WL_SUPPORTED_RATES: @@ -2496,6 +2523,10 @@ *perm = MAC_PROP_PERM_READ; wl_get_scanresults(ic, wldp_buf); break; + case MAC_PROP_WL_CREATE_IBSS: + *perm = MAC_PROP_PERM_READ; + wl_get_createibss(ic, wldp_buf); + break; case MAC_PROP_WL_KEY_TAB: case MAC_PROP_WL_KEY: case MAC_PROP_WL_DELKEY: