On Mon, 2012-05-21 at 19:43 -0700, Bing Zhao wrote: > Hi Johannes, > > > > In .join_ibss handler, mwifiex driver sends a command to firmware to start/join an IBSS network. > > > This command is a synchronous call. When the command response comes > > > back we have started/joined it successfully, otherwise an error code > > > will be returned. However, we are still inside .join_ibss handler at > > > this moment. Calling cfg80211_ibss_joined() gives us the warning > > > because ssid_len hasn't been set by cfg80211 yet. > > > > Hmm. Interesting, because I would think that could potentially take > > quite a while? > > > > It's interesting though because it points out that even if you do call > > it asynchronously, there's no guarantee that it actually happens before > > the function call returns. Maybe we should just move the assignment in > > cfg80211 instead? > > Can we use "sme_state != CFG80211_SME_CONNECTING" check for ibss path too? I don't think that variable is updated for IBSS at all? > diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c > index 30f20fe..3d0930d 100644 > --- a/net/wireless/ibss.c > +++ b/net/wireless/ibss.c > @@ -42,6 +42,7 @@ void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid) > cfg80211_hold_bss(bss_from_pub(bss)); > wdev->current_bss = bss_from_pub(bss); > > + wdev->sme_state = CFG80211_SME_CONNECTED; > cfg80211_upload_connect_keys(wdev); > > nl80211_send_ibss_bssid(wiphy_to_dev(wdev->wiphy), dev, bssid, > @@ -60,7 +61,7 @@ void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp) > struct cfg80211_event *ev; > unsigned long flags; > > - CFG80211_DEV_WARN_ON(!wdev->ssid_len); > + CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTING); > > ev = kzalloc(sizeof(*ev), gfp); > if (!ev) > @@ -115,9 +116,11 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev, > #ifdef CONFIG_CFG80211_WEXT > wdev->wext.ibss.channel = params->channel; > #endif > + wdev->sme_state = CFG80211_SME_CONNECTING; > err = rdev->ops->join_ibss(&rdev->wiphy, dev, params); > if (err) { > wdev->connect_keys = NULL; > + wdev->sme_state = CFG80211_SME_IDLE; > return err; > } > > @@ -169,6 +172,7 @@ static void __cfg80211_clear_ibss(struct net_device *dev, bool nowext) > } > > wdev->current_bss = NULL; > + wdev->sme_state = CFG80211_SME_IDLE; > wdev->ssid_len = 0; > #ifdef CONFIG_CFG80211_WEXT > if (!nowext) Ah, you're updating it now. Hmm, interesting. Seems reasonable to me. johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html