Commit 128ce3b6 authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville

brcmfmac: remove mode from struct brcmf_cfg80211_conf

The mode should be stored and used per virtual interface. Remove
the mode from device global structure and rework the code to use
the mode from brcmf_cfg80211_vif.
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 903e0eee
...@@ -447,7 +447,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, ...@@ -447,7 +447,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
struct vif_params *params) struct vif_params *params)
{ {
struct brcmf_if *ifp = netdev_priv(ndev); struct brcmf_if *ifp = netdev_priv(ndev);
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_vif *vif = ifp->vif;
s32 infra = 0; s32 infra = 0;
s32 ap = 0; s32 ap = 0;
s32 err = 0; s32 err = 0;
...@@ -461,15 +461,15 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, ...@@ -461,15 +461,15 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
type); type);
return -EOPNOTSUPP; return -EOPNOTSUPP;
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
cfg->conf->mode = WL_MODE_IBSS; vif->mode = WL_MODE_IBSS;
infra = 0; infra = 0;
break; break;
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
cfg->conf->mode = WL_MODE_BSS; vif->mode = WL_MODE_BSS;
infra = 1; infra = 1;
break; break;
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
cfg->conf->mode = WL_MODE_AP; vif->mode = WL_MODE_AP;
ap = 1; ap = 1;
break; break;
default: default:
...@@ -478,18 +478,16 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, ...@@ -478,18 +478,16 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
} }
if (ap) { if (ap) {
set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); set_bit(BRCMF_VIF_STATUS_AP_CREATING, &vif->sme_state);
WL_INFO("IF Type = AP\n"); WL_INFO("IF Type = AP\n");
} else { } else {
err = brcmf_fil_cmd_int_set(netdev_priv(ndev), err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
BRCMF_C_SET_INFRA, infra);
if (err) { if (err) {
WL_ERR("WLC_SET_INFRA error (%d)\n", err); WL_ERR("WLC_SET_INFRA error (%d)\n", err);
err = -EAGAIN; err = -EAGAIN;
goto done; goto done;
} }
WL_INFO("IF Type = %s\n", WL_INFO("IF Type = %s\n", (vif->mode == WL_MODE_IBSS) ?
(cfg->conf->mode == WL_MODE_IBSS) ?
"Adhoc" : "Infra"); "Adhoc" : "Infra");
} }
ndev->ieee80211_ptr->iftype = type; ndev->ieee80211_ptr->iftype = type;
...@@ -1711,7 +1709,6 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1711,7 +1709,6 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
u8 key_idx, bool pairwise, const u8 *mac_addr, u8 key_idx, bool pairwise, const u8 *mac_addr,
struct key_params *params) struct key_params *params)
{ {
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_wsec_key key; struct brcmf_wsec_key key;
s32 val; s32 val;
...@@ -1753,7 +1750,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1753,7 +1750,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
WL_CONN("WLAN_CIPHER_SUITE_WEP104\n"); WL_CONN("WLAN_CIPHER_SUITE_WEP104\n");
break; break;
case WLAN_CIPHER_SUITE_TKIP: case WLAN_CIPHER_SUITE_TKIP:
if (cfg->conf->mode != WL_MODE_AP) { if (ifp->vif->mode != WL_MODE_AP) {
WL_CONN("Swapping key\n"); WL_CONN("Swapping key\n");
memcpy(keybuf, &key.data[24], sizeof(keybuf)); memcpy(keybuf, &key.data[24], sizeof(keybuf));
memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); memcpy(&key.data[24], &key.data[16], sizeof(keybuf));
...@@ -1903,7 +1900,6 @@ static s32 ...@@ -1903,7 +1900,6 @@ static s32
brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
u8 *mac, struct station_info *sinfo) u8 *mac, struct station_info *sinfo)
{ {
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 scb_val; struct brcmf_scb_val_le scb_val;
...@@ -1917,7 +1913,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1917,7 +1913,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
if (!check_vif_up(ifp->vif)) if (!check_vif_up(ifp->vif))
return -EIO; return -EIO;
if (cfg->conf->mode == WL_MODE_AP) { if (ifp->vif->mode == WL_MODE_AP) {
memcpy(&sta_info_le, mac, ETH_ALEN); memcpy(&sta_info_le, mac, ETH_ALEN);
err = brcmf_fil_iovar_data_get(ifp, "sta_info", err = brcmf_fil_iovar_data_get(ifp, "sta_info",
&sta_info_le, &sta_info_le,
...@@ -1934,7 +1930,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1934,7 +1930,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
} }
WL_TRACE("STA idle time : %d ms, connected time :%d sec\n", WL_TRACE("STA idle time : %d ms, connected time :%d sec\n",
sinfo->inactive_time, sinfo->connected_time); sinfo->inactive_time, sinfo->connected_time);
} else if (cfg->conf->mode == WL_MODE_BSS) { } else if (ifp->vif->mode == WL_MODE_BSS) {
if (memcmp(mac, bssid, ETH_ALEN)) { if (memcmp(mac, bssid, ETH_ALEN)) {
WL_ERR("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n", WL_ERR("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n",
mac, bssid); mac, bssid);
...@@ -2244,9 +2240,9 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg, ...@@ -2244,9 +2240,9 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg,
return err; return err;
} }
static bool brcmf_is_ibssmode(struct brcmf_cfg80211_info *cfg) static bool brcmf_is_ibssmode(struct brcmf_cfg80211_vif *vif)
{ {
return cfg->conf->mode == WL_MODE_IBSS; return vif->mode == WL_MODE_IBSS;
} }
/* /*
...@@ -2331,7 +2327,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg) ...@@ -2331,7 +2327,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg)
s32 err = 0; s32 err = 0;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (brcmf_is_ibssmode(cfg)) if (brcmf_is_ibssmode(ifp->vif))
return err; return err;
ssid = &profile->ssid; ssid = &profile->ssid;
...@@ -3634,22 +3630,20 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, ...@@ -3634,22 +3630,20 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
{ {
struct brcmf_if *ifp = netdev_priv(ndev); struct brcmf_if *ifp = netdev_priv(ndev);
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
s32 err = -EPERM; s32 err = -EPERM;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (cfg->conf->mode == WL_MODE_AP) { if (ifp->vif->mode == WL_MODE_AP) {
/* Due to most likely deauths outstanding we sleep */ /* Due to most likely deauths outstanding we sleep */
/* first to make sure they get processed by fw. */ /* first to make sure they get processed by fw. */
msleep(400); msleep(400);
err = brcmf_fil_cmd_int_set(netdev_priv(ndev), err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
BRCMF_C_SET_AP, 0);
if (err < 0) { if (err < 0) {
WL_ERR("setting AP mode failed %d\n", err); WL_ERR("setting AP mode failed %d\n", err);
goto exit; goto exit;
} }
err = brcmf_fil_cmd_int_set(netdev_priv(ndev), BRCMF_C_UP, 0); err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0);
if (err < 0) { if (err < 0) {
WL_ERR("BRCMF_C_UP error %d\n", err); WL_ERR("BRCMF_C_UP error %d\n", err);
goto exit; goto exit;
...@@ -4103,11 +4097,11 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, ...@@ -4103,11 +4097,11 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,
struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
s32 err = 0; s32 err = 0;
if (cfg->conf->mode == WL_MODE_AP) { if (ifp->vif->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(e)) { } else if (brcmf_is_linkup(e)) {
WL_CONN("Linkup\n"); WL_CONN("Linkup\n");
if (brcmf_is_ibssmode(cfg)) { if (brcmf_is_ibssmode(ifp->vif)) {
memcpy(profile->bssid, e->addr, ETH_ALEN); memcpy(profile->bssid, e->addr, ETH_ALEN);
wl_inform_ibss(cfg, ndev, e->addr); wl_inform_ibss(cfg, ndev, e->addr);
cfg80211_ibss_joined(ndev, e->addr, GFP_KERNEL); cfg80211_ibss_joined(ndev, e->addr, GFP_KERNEL);
...@@ -4119,7 +4113,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, ...@@ -4119,7 +4113,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,
brcmf_bss_connect_done(cfg, ndev, e, true); brcmf_bss_connect_done(cfg, ndev, e, true);
} else if (brcmf_is_linkdown(e)) { } else if (brcmf_is_linkdown(e)) {
WL_CONN("Linkdown\n"); WL_CONN("Linkdown\n");
if (!brcmf_is_ibssmode(cfg)) { if (!brcmf_is_ibssmode(ifp->vif)) {
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))
...@@ -4129,7 +4123,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, ...@@ -4129,7 +4123,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,
brcmf_link_down(ifp->vif); 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(ifp->vif))
clear_bit(BRCMF_VIF_STATUS_CONNECTING, clear_bit(BRCMF_VIF_STATUS_CONNECTING,
&ifp->vif->sme_state); &ifp->vif->sme_state);
else else
...@@ -4178,7 +4172,6 @@ brcmf_notify_mic_status(struct brcmf_if *ifp, ...@@ -4178,7 +4172,6 @@ brcmf_notify_mic_status(struct brcmf_if *ifp,
static void brcmf_init_conf(struct brcmf_cfg80211_conf *conf) static void brcmf_init_conf(struct brcmf_cfg80211_conf *conf)
{ {
conf->mode = (u32)-1;
conf->frag_threshold = (u32)-1; conf->frag_threshold = (u32)-1;
conf->rts_threshold = (u32)-1; conf->rts_threshold = (u32)-1;
conf->retry_short = (u32)-1; conf->retry_short = (u32)-1;
......
...@@ -128,7 +128,6 @@ enum wl_mode { ...@@ -128,7 +128,6 @@ enum wl_mode {
/* dongle configuration */ /* dongle configuration */
struct brcmf_cfg80211_conf { struct brcmf_cfg80211_conf {
u32 mode; /* adhoc , infrastructure or ap */
u32 frag_threshold; u32 frag_threshold;
u32 rts_threshold; u32 rts_threshold;
u32 retry_short; u32 retry_short;
......
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