Message ID | 20160318141618.GA9485@w1.fi |
---|---|
State | Accepted |
Headers | show |
I am using the Marvell driver sd8887 without any particular wpa_supplicant configuration. I also agree that your fix is more appropriated. I tried it and it works also with Marvell driver. I think that mac80211_hwsim does not take into account smps_mode parameter when ht is disabled, which is right. But instead, Marvell driver and maybe others report error -22 (Invalid argument) if they receive smps_mode and it is set to a value different than OFF; of course when disable_ht=1. On the other hand, I would like to make a question (I do not know if it should be done in another discussion, if so let me know and I will create a new one). The fact is that I have been able to use a, g, n and ac 802.11 modes but not b. I get 802.11n or ac using disable_ht and disable_vht parameters. Additionally, if I disable both parameters I get 802.11g mode and if I also set frequency to a channel in 5GHz I get 802.11a mode. But I do not know how to properly set the network parameters to enable 802.11b mode. How can I do this? Thanks for your help! On Fri, Mar 18, 2016 at 3:16 PM, Jouni Malinen <j@w1.fi> wrote: > On Fri, Mar 18, 2016 at 02:11:13PM +0100, Jose Blanquicet wrote: >> You are probably right, the problem could be that smps attribute is added >> without verify if it is going to do HT. In function wpa_driver_nl80211_set_ap: >> >> if (nla_put_u32(msg, NL80211_ATTR_SMPS_MODE, smps_mode)) >> goto fail; >> >> When I set it to HT_CAP_INFO_SMPS_DISABLED, nl80211 shoul ignore it >> and that's the reason why it works. > > Which driver are you using when testing this and what kind of > wpa_supplicant configuration? I was unable to reproduce the error > message with mac80211_hwsim, i.e., the AP did come up with HT disabled > when configuring the network with disable_ht=1. > > That said, the attribute should not be there and the proper fix would > likely look like this: > > > diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c > index 5fb6652..b4c3462 100644 > --- a/src/drivers/driver_nl80211.c > +++ b/src/drivers/driver_nl80211.c > @@ -3526,24 +3526,26 @@ static int wpa_driver_nl80211_set_ap(void *priv, > nla_put_u32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, suite)) > goto fail; > > - switch (params->smps_mode) { > - case HT_CAP_INFO_SMPS_DYNAMIC: > - wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - dynamic"); > - smps_mode = NL80211_SMPS_DYNAMIC; > - break; > - case HT_CAP_INFO_SMPS_STATIC: > - wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - static"); > - smps_mode = NL80211_SMPS_STATIC; > - break; > - default: > - /* invalid - fallback to smps off */ > - case HT_CAP_INFO_SMPS_DISABLED: > - wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - off"); > - smps_mode = NL80211_SMPS_OFF; > - break; > + if (params->ht_opmode != -1) { > + switch (params->smps_mode) { > + case HT_CAP_INFO_SMPS_DYNAMIC: > + wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - dynamic"); > + smps_mode = NL80211_SMPS_DYNAMIC; > + break; > + case HT_CAP_INFO_SMPS_STATIC: > + wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - static"); > + smps_mode = NL80211_SMPS_STATIC; > + break; > + default: > + /* invalid - fallback to smps off */ > + case HT_CAP_INFO_SMPS_DISABLED: > + wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - off"); > + smps_mode = NL80211_SMPS_OFF; > + break; > + } > + if (nla_put_u32(msg, NL80211_ATTR_SMPS_MODE, smps_mode)) > + goto fail; > } > - if (nla_put_u32(msg, NL80211_ATTR_SMPS_MODE, smps_mode)) > - goto fail; > > if (params->beacon_ies) { > wpa_hexdump_buf(MSG_DEBUG, "nl80211: beacon_ies", > > > -- > Jouni Malinen PGP id EFC895FA
On Fri, Mar 18, 2016 at 05:13:28PM +0100, Jose Blanquicet wrote: > I am using the Marvell driver sd8887 without any particular wpa_supplicant > configuration. > > I also agree that your fix is more appropriated. I tried it and it > works also with > Marvell driver. Thanks. > I think that mac80211_hwsim does not take into account > smps_mode parameter when ht is disabled, which is right. But instead, > Marvell driver and maybe others report error -22 (Invalid argument) if they > receive smps_mode and it is set to a value different than OFF; of course > when disable_ht=1. Well, wpa_supplicant should not really be adding this attribute in such a case and I'll push in the fix for that. > On the other hand, I would like to make a question (I do not know if it should > be done in another discussion, if so let me know and I will create a new one). > The fact is that I have been able to use a, g, n and ac 802.11 modes but not > b. I get 802.11n or ac using disable_ht and disable_vht parameters. > Additionally, if I disable both parameters I get 802.11g mode and if I also set > frequency to a channel in 5GHz I get 802.11a mode. But I do not know how > to properly set the network parameters to enable 802.11b mode. How can I > do this? I don't think wpa_supplicant supports this. You can use hostapd to be configure AP with hw_mode=b if you need to configure this special (i.e., obsolete..) case.
Hello, On Fri, Mar 18, 2016 at 6:54 PM, Jouni Malinen <j@w1.fi> wrote: > On Fri, Mar 18, 2016 at 05:13:28PM +0100, Jose Blanquicet wrote: >> I am using the Marvell driver sd8887 without any particular wpa_supplicant >> configuration. >> >> I also agree that your fix is more appropriated. I tried it and it >> works also with >> Marvell driver. > > Thanks. > >> I think that mac80211_hwsim does not take into account >> smps_mode parameter when ht is disabled, which is right. But instead, >> Marvell driver and maybe others report error -22 (Invalid argument) if they >> receive smps_mode and it is set to a value different than OFF; of course >> when disable_ht=1. > > Well, wpa_supplicant should not really be adding this attribute in such > a case and I'll push in the fix for that. > I agree. Thanks! >> On the other hand, I would like to make a question (I do not know if it should >> be done in another discussion, if so let me know and I will create a new one). >> The fact is that I have been able to use a, g, n and ac 802.11 modes but not >> b. I get 802.11n or ac using disable_ht and disable_vht parameters. >> Additionally, if I disable both parameters I get 802.11g mode and if I also set >> frequency to a channel in 5GHz I get 802.11a mode. But I do not know how >> to properly set the network parameters to enable 802.11b mode. How can I >> do this? > > I don't think wpa_supplicant supports this. You can use hostapd to be > configure AP with hw_mode=b if you need to configure this special (i.e., > obsolete..) case. > I know nobody will use 802.11b mode but in order to get the Wi-Fi Alliance Certification in 802.11n, the system must be able to be configured in a/b/g/n modes. Therefore, as I explained before, I was trying to understand how to set properly the network parameters to get all those modes. The wpa_supplicant already provides the way to enable a/g/n/ac modes, thus I would expect that it also provides a way to use b mode. As you told, the hostapd provides very easy way to configure the mode but I will always try to keep the system as simple as possible, therefore I would add an additional module, hostapd in this case, only if it is absolutely required. Best regards, Jose Blanquicet > -- > Jouni Malinen PGP id EFC895FA
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 5fb6652..b4c3462 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -3526,24 +3526,26 @@ static int wpa_driver_nl80211_set_ap(void *priv, nla_put_u32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, suite)) goto fail; - switch (params->smps_mode) { - case HT_CAP_INFO_SMPS_DYNAMIC: - wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - dynamic"); - smps_mode = NL80211_SMPS_DYNAMIC; - break; - case HT_CAP_INFO_SMPS_STATIC: - wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - static"); - smps_mode = NL80211_SMPS_STATIC; - break; - default: - /* invalid - fallback to smps off */ - case HT_CAP_INFO_SMPS_DISABLED: - wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - off"); - smps_mode = NL80211_SMPS_OFF; - break; + if (params->ht_opmode != -1) { + switch (params->smps_mode) { + case HT_CAP_INFO_SMPS_DYNAMIC: + wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - dynamic"); + smps_mode = NL80211_SMPS_DYNAMIC; + break; + case HT_CAP_INFO_SMPS_STATIC: + wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - static"); + smps_mode = NL80211_SMPS_STATIC; + break; + default: + /* invalid - fallback to smps off */ + case HT_CAP_INFO_SMPS_DISABLED: + wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - off"); + smps_mode = NL80211_SMPS_OFF; + break; + } + if (nla_put_u32(msg, NL80211_ATTR_SMPS_MODE, smps_mode)) + goto fail; } - if (nla_put_u32(msg, NL80211_ATTR_SMPS_MODE, smps_mode)) - goto fail; if (params->beacon_ies) { wpa_hexdump_buf(MSG_DEBUG, "nl80211: beacon_ies",