Commit 903e0eee authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville

brcmfmac: get rid of struct brcmf_cfg80211_info::link_up attribute

This attribute indicates successful IBSS or AP connection has been
established. However, this no longer works for virtual interfaces.
As it turns out this attribute is identical to the CONNECTED bit
in struct brcmf_cfg80211_vif::sme_state. This patch removes the
attribute and rework some functions relying on it.
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarFranky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent b6fc28a1
...@@ -963,22 +963,21 @@ static void brcmf_ch_to_chanspec(int ch, struct brcmf_join_params *join_params, ...@@ -963,22 +963,21 @@ static void brcmf_ch_to_chanspec(int ch, struct brcmf_join_params *join_params,
} }
} }
static void brcmf_link_down(struct brcmf_cfg80211_info *cfg) static void brcmf_link_down(struct brcmf_cfg80211_vif *vif)
{ {
struct net_device *ndev = NULL;
s32 err = 0; s32 err = 0;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (cfg->link_up) { if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) {
ndev = cfg_to_ndev(cfg);
WL_INFO("Call WLC_DISASSOC to stop excess roaming\n "); WL_INFO("Call WLC_DISASSOC to stop excess roaming\n ");
err = brcmf_fil_cmd_data_set(netdev_priv(ndev), err = brcmf_fil_cmd_data_set(vif->ifp,
BRCMF_C_DISASSOC, NULL, 0); BRCMF_C_DISASSOC, NULL, 0);
if (err) if (err)
WL_ERR("WLC_DISASSOC failed (%d)\n", err); WL_ERR("WLC_DISASSOC failed (%d)\n", err);
cfg->link_up = false; clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state);
} }
clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state);
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
} }
...@@ -1130,7 +1129,6 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1130,7 +1129,6 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
static s32 static s32
brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
{ {
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_if *ifp = netdev_priv(ndev); struct brcmf_if *ifp = netdev_priv(ndev);
s32 err = 0; s32 err = 0;
...@@ -1138,7 +1136,7 @@ brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) ...@@ -1138,7 +1136,7 @@ brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
if (!check_vif_up(ifp->vif)) if (!check_vif_up(ifp->vif))
return -EIO; return -EIO;
brcmf_link_down(cfg); brcmf_link_down(ifp->vif);
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
...@@ -1496,7 +1494,6 @@ static s32 ...@@ -1496,7 +1494,6 @@ static s32
brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev, brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
u16 reason_code) u16 reason_code)
{ {
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_if *ifp = netdev_priv(ndev); struct brcmf_if *ifp = netdev_priv(ndev);
struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
struct brcmf_scb_val_le scbval; struct brcmf_scb_val_le scbval;
...@@ -1515,8 +1512,6 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1515,8 +1512,6 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
if (err) if (err)
WL_ERR("error (%d)\n", err); WL_ERR("error (%d)\n", err);
cfg->link_up = false;
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
return err; return err;
} }
...@@ -2596,10 +2591,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, ...@@ -2596,10 +2591,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
* While going to suspend if associated with AP disassociate * While going to suspend if associated with AP disassociate
* from AP to save power while system is in suspended state * from AP to save power while system is in suspended state
*/ */
if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state) || brcmf_link_down(vif);
test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) {
WL_INFO("Disassociating from AP before suspend\n");
brcmf_link_down(cfg);
/* Make sure WPA_Supplicant receives all the event /* Make sure WPA_Supplicant receives all the event
* generated due to DISASSOC call to the fw to keep * generated due to DISASSOC call to the fw to keep
...@@ -2607,7 +2599,6 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, ...@@ -2607,7 +2599,6 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
*/ */
brcmf_delay(500); brcmf_delay(500);
} }
}
/* end any scanning */ /* end any scanning */
if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status))
...@@ -3849,23 +3840,20 @@ static void brcmf_free_vif(struct brcmf_cfg80211_vif *vif) ...@@ -3849,23 +3840,20 @@ static void brcmf_free_vif(struct brcmf_cfg80211_vif *vif)
} }
} }
static bool brcmf_is_linkup(struct brcmf_cfg80211_info *cfg, static bool brcmf_is_linkup(const struct brcmf_event_msg *e)
const struct brcmf_event_msg *e)
{ {
u32 event = e->event_code; u32 event = e->event_code;
u32 status = e->status; u32 status = e->status;
if (event == BRCMF_E_SET_SSID && status == BRCMF_E_STATUS_SUCCESS) { if (event == BRCMF_E_SET_SSID && status == BRCMF_E_STATUS_SUCCESS) {
WL_CONN("Processing set ssid\n"); WL_CONN("Processing set ssid\n");
cfg->link_up = true;
return true; return true;
} }
return false; return false;
} }
static bool brcmf_is_linkdown(struct brcmf_cfg80211_info *cfg, static bool brcmf_is_linkdown(const struct brcmf_event_msg *e)
const struct brcmf_event_msg *e)
{ {
u32 event = e->event_code; u32 event = e->event_code;
u16 flags = e->flags; u16 flags = e->flags;
...@@ -4117,7 +4105,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, ...@@ -4117,7 +4105,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,
if (cfg->conf->mode == WL_MODE_AP) { if (cfg->conf->mode == WL_MODE_AP) {
err = brcmf_notify_connect_status_ap(cfg, ndev, e, data); err = brcmf_notify_connect_status_ap(cfg, ndev, e, data);
} else if (brcmf_is_linkup(cfg, e)) { } else if (brcmf_is_linkup(e)) {
WL_CONN("Linkup\n"); WL_CONN("Linkup\n");
if (brcmf_is_ibssmode(cfg)) { if (brcmf_is_ibssmode(cfg)) {
memcpy(profile->bssid, e->addr, ETH_ALEN); memcpy(profile->bssid, e->addr, ETH_ALEN);
...@@ -4129,23 +4117,16 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, ...@@ -4129,23 +4117,16 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,
&ifp->vif->sme_state); &ifp->vif->sme_state);
} else } else
brcmf_bss_connect_done(cfg, ndev, e, true); brcmf_bss_connect_done(cfg, ndev, e, true);
} else if (brcmf_is_linkdown(cfg, e)) { } else if (brcmf_is_linkdown(e)) {
WL_CONN("Linkdown\n"); WL_CONN("Linkdown\n");
if (brcmf_is_ibssmode(cfg)) { if (!brcmf_is_ibssmode(cfg)) {
clear_bit(BRCMF_VIF_STATUS_CONNECTING,
&ifp->vif->sme_state);
if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED,
&ifp->vif->sme_state))
brcmf_link_down(cfg);
} else {
brcmf_bss_connect_done(cfg, ndev, e, false); brcmf_bss_connect_done(cfg, ndev, e, false);
if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED,
&ifp->vif->sme_state)) { &ifp->vif->sme_state))
cfg80211_disconnected(ndev, 0, NULL, 0, cfg80211_disconnected(ndev, 0, NULL, 0,
GFP_KERNEL); GFP_KERNEL);
brcmf_link_down(cfg);
}
} }
brcmf_link_down(ifp->vif);
brcmf_init_prof(ndev_to_prof(ndev)); brcmf_init_prof(ndev_to_prof(ndev));
} else if (brcmf_is_nonetwork(cfg, e)) { } else if (brcmf_is_nonetwork(cfg, e)) {
if (brcmf_is_ibssmode(cfg)) if (brcmf_is_ibssmode(cfg))
...@@ -4282,7 +4263,6 @@ static s32 wl_init_priv(struct brcmf_cfg80211_info *cfg) ...@@ -4282,7 +4263,6 @@ static s32 wl_init_priv(struct brcmf_cfg80211_info *cfg)
mutex_init(&cfg->usr_sync); mutex_init(&cfg->usr_sync);
brcmf_init_escan(cfg); brcmf_init_escan(cfg);
brcmf_init_conf(cfg->conf); brcmf_init_conf(cfg->conf);
brcmf_link_down(cfg);
return err; return err;
} }
...@@ -4290,7 +4270,6 @@ static s32 wl_init_priv(struct brcmf_cfg80211_info *cfg) ...@@ -4290,7 +4270,6 @@ static s32 wl_init_priv(struct brcmf_cfg80211_info *cfg)
static void wl_deinit_priv(struct brcmf_cfg80211_info *cfg) static void wl_deinit_priv(struct brcmf_cfg80211_info *cfg)
{ {
cfg->dongle_up = false; /* dongle down */ cfg->dongle_up = false; /* dongle down */
brcmf_link_down(cfg);
brcmf_abort_scanning(cfg); brcmf_abort_scanning(cfg);
brcmf_deinit_priv_mem(cfg); brcmf_deinit_priv_mem(cfg);
} }
...@@ -4537,11 +4516,8 @@ static s32 __brcmf_cfg80211_down(struct brcmf_if *ifp) ...@@ -4537,11 +4516,8 @@ static s32 __brcmf_cfg80211_down(struct brcmf_if *ifp)
* While going down, if associated with AP disassociate * While going down, if associated with AP disassociate
* from AP to save power * from AP to save power
*/ */
if ((test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state) || if (check_vif_up(ifp->vif)) {
test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) && brcmf_link_down(ifp->vif);
check_vif_up(ifp->vif)) {
WL_INFO("Disassociating from AP");
brcmf_link_down(cfg);
/* Make sure WPA_Supplicant receives all the event /* Make sure WPA_Supplicant receives all the event
generated due to DISASSOC call to the fw to keep generated due to DISASSOC call to the fw to keep
......
...@@ -359,7 +359,6 @@ struct brcmf_pno_scanresults_le { ...@@ -359,7 +359,6 @@ struct brcmf_pno_scanresults_le {
* @active_scan: current scan mode. * @active_scan: current scan mode.
* @sched_escan: e-scan for scheduled scan support running. * @sched_escan: e-scan for scheduled scan support running.
* @ibss_starter: indicates this sta is ibss starter. * @ibss_starter: indicates this sta is ibss starter.
* @link_up: link/connection up flag.
* @pwr_save: indicate whether dongle to support power save mode. * @pwr_save: indicate whether dongle to support power save mode.
* @dongle_up: indicate whether dongle up or not. * @dongle_up: indicate whether dongle up or not.
* @roam_on: on/off switch for dongle self-roaming. * @roam_on: on/off switch for dongle self-roaming.
...@@ -391,7 +390,6 @@ struct brcmf_cfg80211_info { ...@@ -391,7 +390,6 @@ struct brcmf_cfg80211_info {
bool active_scan; bool active_scan;
bool sched_escan; bool sched_escan;
bool ibss_starter; bool ibss_starter;
bool link_up;
bool pwr_save; bool pwr_save;
bool dongle_up; bool dongle_up;
bool roam_on; bool roam_on;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment