Commit d6f2da5b authored by Jiri Slaby's avatar Jiri Slaby Committed by David S. Miller

[MAC80211]: Remove bitfields from struct ieee80211_if_sta

mac80211, remove bitfields from struct ieee80211_if_sta
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Acked-by: default avatarMichael Wu <flamingice@sourmilk.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent badffb72
......@@ -112,13 +112,13 @@ static ssize_t ieee80211_if_fmt_flags(
const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
{
return scnprintf(buf, buflen, "%s%s%s%s%s%s%s\n",
sdata->u.sta.ssid_set ? "SSID\n" : "",
sdata->u.sta.bssid_set ? "BSSID\n" : "",
sdata->u.sta.prev_bssid_set ? "prev BSSID\n" : "",
sdata->u.sta.authenticated ? "AUTH\n" : "",
sdata->u.sta.associated ? "ASSOC\n" : "",
sdata->u.sta.probereq_poll ? "PROBEREQ POLL\n" : "",
sdata->use_protection ? "CTS prot\n" : "");
sdata->u.sta.flags & IEEE80211_STA_SSID_SET ? "SSID\n" : "",
sdata->u.sta.flags & IEEE80211_STA_BSSID_SET ? "BSSID\n" : "",
sdata->u.sta.flags & IEEE80211_STA_PREV_BSSID_SET ? "prev BSSID\n" : "",
sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "",
sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "",
sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "",
sdata->use_protection ? "CTS prot\n" : "");
}
__IEEE80211_IF_FILE(flags);
......
......@@ -354,7 +354,7 @@ static void ieee80211_if_open(struct net_device *dev)
switch (sdata->type) {
case IEEE80211_IF_TYPE_STA:
case IEEE80211_IF_TYPE_IBSS:
sdata->u.sta.prev_bssid_set = 0;
sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET;
break;
}
}
......
......@@ -217,6 +217,19 @@ struct ieee80211_if_vlan {
u8 id;
};
/* flags used in struct ieee80211_if_sta.flags */
#define IEEE80211_STA_SSID_SET BIT(0)
#define IEEE80211_STA_BSSID_SET BIT(1)
#define IEEE80211_STA_PREV_BSSID_SET BIT(2)
#define IEEE80211_STA_AUTHENTICATED BIT(3)
#define IEEE80211_STA_ASSOCIATED BIT(4)
#define IEEE80211_STA_PROBEREQ_POLL BIT(5)
#define IEEE80211_STA_CREATE_IBSS BIT(6)
#define IEEE80211_STA_MIXED_CELL BIT(7)
#define IEEE80211_STA_WMM_ENABLED BIT(8)
#define IEEE80211_STA_AUTO_SSID_SEL BIT(10)
#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11)
#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)
struct ieee80211_if_sta {
enum {
IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
......@@ -239,18 +252,7 @@ struct ieee80211_if_sta {
int auth_tries, assoc_tries;
unsigned int ssid_set:1;
unsigned int bssid_set:1;
unsigned int prev_bssid_set:1;
unsigned int authenticated:1;
unsigned int associated:1;
unsigned int probereq_poll:1;
unsigned int create_ibss:1;
unsigned int mixed_cell:1;
unsigned int wmm_enabled:1;
unsigned int auto_ssid_sel:1;
unsigned int auto_bssid_sel:1;
unsigned int auto_channel_sel:1;
unsigned int flags;
#define IEEE80211_STA_REQ_SCAN 0
#define IEEE80211_STA_REQ_AUTH 1
#define IEEE80211_STA_REQ_RUN 2
......
......@@ -187,10 +187,10 @@ void ieee80211_if_set_type(struct net_device *dev, int type)
ifsta->capab = WLAN_CAPABILITY_ESS;
ifsta->auth_algs = IEEE80211_AUTH_ALG_OPEN |
IEEE80211_AUTH_ALG_SHARED_KEY;
ifsta->create_ibss = 1;
ifsta->wmm_enabled = 1;
ifsta->auto_channel_sel = 1;
ifsta->auto_bssid_sel = 1;
ifsta->flags |= IEEE80211_STA_CREATE_IBSS |
IEEE80211_STA_WMM_ENABLED |
IEEE80211_STA_AUTO_BSSID_SEL |
IEEE80211_STA_AUTO_CHANNEL_SEL;
msdata = IEEE80211_DEV_TO_SUB_IF(sdata->local->mdev);
sdata->bss = &msdata->u.ap;
......
......@@ -270,7 +270,7 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev,
int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length);
if (ret)
return ret;
sdata->u.sta.auto_bssid_sel = 0;
sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
ieee80211_sta_req_auth(dev, &sdata->u.sta);
return 0;
}
......@@ -502,13 +502,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev,
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->type == IEEE80211_IF_TYPE_STA)
sdata->u.sta.auto_channel_sel = 0;
sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
/* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
if (freq->e == 0) {
if (freq->m < 0) {
if (sdata->type == IEEE80211_IF_TYPE_STA)
sdata->u.sta.auto_channel_sel = 1;
sdata->u.sta.flags |=
IEEE80211_STA_AUTO_CHANNEL_SEL;
return 0;
} else
return ieee80211_set_channel(local, freq->m, -1);
......@@ -563,7 +564,10 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
sdata->u.sta.ssid_len = len;
return 0;
}
sdata->u.sta.auto_ssid_sel = !data->flags;
if (data->flags)
sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
else
sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL;
ret = ieee80211_sta_set_ssid(dev, ssid, len);
if (ret)
return ret;
......@@ -630,13 +634,13 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
ETH_ALEN);
return 0;
}
if (is_zero_ether_addr((u8 *) &ap_addr->sa_data)) {
sdata->u.sta.auto_bssid_sel = 1;
sdata->u.sta.auto_channel_sel = 1;
} else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data))
sdata->u.sta.auto_bssid_sel = 1;
if (is_zero_ether_addr((u8 *) &ap_addr->sa_data))
sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL |
IEEE80211_STA_AUTO_CHANNEL_SEL;
else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data))
sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL;
else
sdata->u.sta.auto_bssid_sel = 0;
sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data);
if (ret)
return ret;
......@@ -1104,8 +1108,12 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
if (sdata->type != IEEE80211_IF_TYPE_STA &&
sdata->type != IEEE80211_IF_TYPE_IBSS)
ret = -EINVAL;
else
sdata->u.sta.mixed_cell = !!value;
else {
if (value)
sdata->u.sta.flags |= IEEE80211_STA_MIXED_CELL;
else
sdata->u.sta.flags &= ~IEEE80211_STA_MIXED_CELL;
}
break;
case PRISM2_PARAM_HW_MODES:
......@@ -1115,15 +1123,23 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
case PRISM2_PARAM_CREATE_IBSS:
if (sdata->type != IEEE80211_IF_TYPE_IBSS)
ret = -EINVAL;
else
sdata->u.sta.create_ibss = !!value;
else {
if (value)
sdata->u.sta.flags |= IEEE80211_STA_CREATE_IBSS;
else
sdata->u.sta.flags &= ~IEEE80211_STA_CREATE_IBSS;
}
break;
case PRISM2_PARAM_WMM_ENABLED:
if (sdata->type != IEEE80211_IF_TYPE_STA &&
sdata->type != IEEE80211_IF_TYPE_IBSS)
ret = -EINVAL;
else
sdata->u.sta.wmm_enabled = !!value;
else {
if (value)
sdata->u.sta.flags |= IEEE80211_STA_WMM_ENABLED;
else
sdata->u.sta.flags &= ~IEEE80211_STA_WMM_ENABLED;
}
break;
default:
ret = -EOPNOTSUPP;
......@@ -1186,7 +1202,8 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
if (sdata->type != IEEE80211_IF_TYPE_IBSS)
ret = -EINVAL;
else
*param = !!sdata->u.sta.create_ibss;
*param = !!(sdata->u.sta.flags &
IEEE80211_STA_CREATE_IBSS);
break;
case PRISM2_PARAM_MIXED_CELL:
......@@ -1194,14 +1211,16 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
sdata->type != IEEE80211_IF_TYPE_IBSS)
ret = -EINVAL;
else
*param = !!sdata->u.sta.mixed_cell;
*param = !!(sdata->u.sta.flags &
IEEE80211_STA_MIXED_CELL);
break;
case PRISM2_PARAM_WMM_ENABLED:
if (sdata->type != IEEE80211_IF_TYPE_STA &&
sdata->type != IEEE80211_IF_TYPE_IBSS)
ret = -EINVAL;
else
*param = !!sdata->u.sta.wmm_enabled;
*param = !!(sdata->u.sta.flags &
IEEE80211_STA_WMM_ENABLED);
break;
default:
ret = -EOPNOTSUPP;
......
This diff is collapsed.
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