aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/nl80211.h19
-rw-r--r--include/net/cfg80211.h22
-rw-r--r--include/net/mac80211.h9
-rw-r--r--net/mac80211/cfg.c37
-rw-r--r--net/wireless/nl80211.c52
5 files changed, 139 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 2be7c63bc0f2..447c02a5190e 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -89,6 +89,8 @@
89 * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC 89 * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC
90 * or, if no MAC address given, all mesh paths, on the interface identified 90 * or, if no MAC address given, all mesh paths, on the interface identified
91 * by %NL80211_ATTR_IFINDEX. 91 * by %NL80211_ATTR_IFINDEX.
92 * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by
93 * %NL80211_ATTR_IFINDEX.
92 * 94 *
93 * @NL80211_CMD_MAX: highest used command number 95 * @NL80211_CMD_MAX: highest used command number
94 * @__NL80211_CMD_AFTER_LAST: internal use 96 * @__NL80211_CMD_AFTER_LAST: internal use
@@ -127,6 +129,8 @@ enum nl80211_commands {
127 NL80211_CMD_NEW_MPATH, 129 NL80211_CMD_NEW_MPATH,
128 NL80211_CMD_DEL_MPATH, 130 NL80211_CMD_DEL_MPATH,
129 131
132 NL80211_CMD_SET_BSS,
133
130 /* add commands here */ 134 /* add commands here */
131 135
132 /* used to define NL80211_CMD_MAX below */ 136 /* used to define NL80211_CMD_MAX below */
@@ -134,6 +138,11 @@ enum nl80211_commands {
134 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 138 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
135}; 139};
136 140
141/*
142 * Allow user space programs to use #ifdef on new commands by defining them
143 * here
144 */
145#define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS
137 146
138/** 147/**
139 * enum nl80211_attrs - nl80211 netlink attributes 148 * enum nl80211_attrs - nl80211 netlink attributes
@@ -192,6 +201,12 @@ enum nl80211_commands {
192 * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of 201 * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of
193 * &enum nl80211_mntr_flags. 202 * &enum nl80211_mntr_flags.
194 * 203 *
204 * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1)
205 * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled
206 * (u8, 0 or 1)
207 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled
208 * (u8, 0 or 1)
209 *
195 * @NL80211_ATTR_MAX: highest attribute number currently defined 210 * @NL80211_ATTR_MAX: highest attribute number currently defined
196 * @__NL80211_ATTR_AFTER_LAST: internal use 211 * @__NL80211_ATTR_AFTER_LAST: internal use
197 */ 212 */
@@ -235,6 +250,10 @@ enum nl80211_attrs {
235 NL80211_ATTR_MPATH_NEXT_HOP, 250 NL80211_ATTR_MPATH_NEXT_HOP,
236 NL80211_ATTR_MPATH_INFO, 251 NL80211_ATTR_MPATH_INFO,
237 252
253 NL80211_ATTR_BSS_CTS_PROT,
254 NL80211_ATTR_BSS_SHORT_PREAMBLE,
255 NL80211_ATTR_BSS_SHORT_SLOT_TIME,
256
238 /* add attributes here, update the policy in nl80211.c */ 257 /* add attributes here, update the policy in nl80211.c */
239 258
240 __NL80211_ATTR_AFTER_LAST, 259 __NL80211_ATTR_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index e00750836ba5..7afef14d5c5b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -268,6 +268,23 @@ struct mpath_info {
268 u8 flags; 268 u8 flags;
269}; 269};
270 270
271/**
272 * struct bss_parameters - BSS parameters
273 *
274 * Used to change BSS parameters (mainly for AP mode).
275 *
276 * @use_cts_prot: Whether to use CTS protection
277 * (0 = no, 1 = yes, -1 = do not change)
278 * @use_short_preamble: Whether the use of short preambles is allowed
279 * (0 = no, 1 = yes, -1 = do not change)
280 * @use_short_slot_time: Whether the use of short slot time is allowed
281 * (0 = no, 1 = yes, -1 = do not change)
282 */
283struct bss_parameters {
284 int use_cts_prot;
285 int use_short_preamble;
286 int use_short_slot_time;
287};
271 288
272/* from net/wireless.h */ 289/* from net/wireless.h */
273struct wiphy; 290struct wiphy;
@@ -318,6 +335,8 @@ struct wiphy;
318 * @change_station: Modify a given station. 335 * @change_station: Modify a given station.
319 * 336 *
320 * @set_mesh_cfg: set mesh parameters (by now, just mesh id) 337 * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
338 *
339 * @change_bss: Modify parameters for a given BSS.
321 */ 340 */
322struct cfg80211_ops { 341struct cfg80211_ops {
323 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 342 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
@@ -370,6 +389,9 @@ struct cfg80211_ops {
370 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 389 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
371 int idx, u8 *dst, u8 *next_hop, 390 int idx, u8 *dst, u8 *next_hop,
372 struct mpath_info *pinfo); 391 struct mpath_info *pinfo);
392
393 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
394 struct bss_parameters *params);
373}; 395};
374 396
375#endif /* __NET_CFG80211_H */ 397#endif /* __NET_CFG80211_H */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 0fdc3dabc964..7c399a9c11da 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -158,12 +158,14 @@ struct ieee80211_low_level_stats {
158 * also implies a change in the AID. 158 * also implies a change in the AID.
159 * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed 159 * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed
160 * @BSS_CHANGED_ERP_PREAMBLE: preamble changed 160 * @BSS_CHANGED_ERP_PREAMBLE: preamble changed
161 * @BSS_CHANGED_ERP_SLOT: slot timing changed
161 * @BSS_CHANGED_HT: 802.11n parameters changed 162 * @BSS_CHANGED_HT: 802.11n parameters changed
162 */ 163 */
163enum ieee80211_bss_change { 164enum ieee80211_bss_change {
164 BSS_CHANGED_ASSOC = 1<<0, 165 BSS_CHANGED_ASSOC = 1<<0,
165 BSS_CHANGED_ERP_CTS_PROT = 1<<1, 166 BSS_CHANGED_ERP_CTS_PROT = 1<<1,
166 BSS_CHANGED_ERP_PREAMBLE = 1<<2, 167 BSS_CHANGED_ERP_PREAMBLE = 1<<2,
168 BSS_CHANGED_ERP_SLOT = 1<<3,
167 BSS_CHANGED_HT = 1<<4, 169 BSS_CHANGED_HT = 1<<4,
168}; 170};
169 171
@@ -177,6 +179,7 @@ enum ieee80211_bss_change {
177 * @aid: association ID number, valid only when @assoc is true 179 * @aid: association ID number, valid only when @assoc is true
178 * @use_cts_prot: use CTS protection 180 * @use_cts_prot: use CTS protection
179 * @use_short_preamble: use 802.11b short preamble 181 * @use_short_preamble: use 802.11b short preamble
182 * @use_short_slot: use short slot time (only relevant for ERP)
180 * @dtim_period: num of beacons before the next DTIM, for PSM 183 * @dtim_period: num of beacons before the next DTIM, for PSM
181 * @timestamp: beacon timestamp 184 * @timestamp: beacon timestamp
182 * @beacon_int: beacon interval 185 * @beacon_int: beacon interval
@@ -192,6 +195,7 @@ struct ieee80211_bss_conf {
192 /* erp related data */ 195 /* erp related data */
193 bool use_cts_prot; 196 bool use_cts_prot;
194 bool use_short_preamble; 197 bool use_short_preamble;
198 bool use_short_slot;
195 u8 dtim_period; 199 u8 dtim_period;
196 u16 beacon_int; 200 u16 beacon_int;
197 u16 assoc_capability; 201 u16 assoc_capability;
@@ -420,6 +424,11 @@ struct ieee80211_rx_status {
420 * @IEEE80211_CONF_PS: Enable 802.11 power save mode 424 * @IEEE80211_CONF_PS: Enable 802.11 power save mode
421 */ 425 */
422enum ieee80211_conf_flags { 426enum ieee80211_conf_flags {
427 /*
428 * TODO: IEEE80211_CONF_SHORT_SLOT_TIME will be removed once drivers
429 * have been converted to use bss_info_changed() for slot time
430 * configuration
431 */
423 IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), 432 IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0),
424 IEEE80211_CONF_RADIOTAP = (1<<1), 433 IEEE80211_CONF_RADIOTAP = (1<<1),
425 IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), 434 IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2),
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6d2ad2bf3ab5..2b19532f4c8a 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1010,6 +1010,42 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
1010} 1010}
1011#endif 1011#endif
1012 1012
1013static int ieee80211_change_bss(struct wiphy *wiphy,
1014 struct net_device *dev,
1015 struct bss_parameters *params)
1016{
1017 struct ieee80211_local *local = wiphy_priv(wiphy);
1018 struct ieee80211_sub_if_data *sdata;
1019 u32 changed = 0;
1020
1021 if (dev == local->mdev)
1022 return -EOPNOTSUPP;
1023
1024 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1025
1026 if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
1027 return -EINVAL;
1028
1029 if (params->use_cts_prot >= 0) {
1030 sdata->bss_conf.use_cts_prot = params->use_cts_prot;
1031 changed |= BSS_CHANGED_ERP_CTS_PROT;
1032 }
1033 if (params->use_short_preamble >= 0) {
1034 sdata->bss_conf.use_short_preamble =
1035 params->use_short_preamble;
1036 changed |= BSS_CHANGED_ERP_PREAMBLE;
1037 }
1038 if (params->use_short_slot_time >= 0) {
1039 sdata->bss_conf.use_short_slot =
1040 params->use_short_slot_time;
1041 changed |= BSS_CHANGED_ERP_SLOT;
1042 }
1043
1044 ieee80211_bss_info_change_notify(sdata, changed);
1045
1046 return 0;
1047}
1048
1013struct cfg80211_ops mac80211_config_ops = { 1049struct cfg80211_ops mac80211_config_ops = {
1014 .add_virtual_intf = ieee80211_add_iface, 1050 .add_virtual_intf = ieee80211_add_iface,
1015 .del_virtual_intf = ieee80211_del_iface, 1051 .del_virtual_intf = ieee80211_del_iface,
@@ -1033,4 +1069,5 @@ struct cfg80211_ops mac80211_config_ops = {
1033 .get_mpath = ieee80211_get_mpath, 1069 .get_mpath = ieee80211_get_mpath,
1034 .dump_mpath = ieee80211_dump_mpath, 1070 .dump_mpath = ieee80211_dump_mpath,
1035#endif 1071#endif
1072 .change_bss = ieee80211_change_bss,
1036}; 1073};
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 59eb2cf42e5f..47542ee01c57 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -87,6 +87,10 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = {
87 [NL80211_ATTR_MESH_ID] = { .type = NLA_BINARY, 87 [NL80211_ATTR_MESH_ID] = { .type = NLA_BINARY,
88 .len = IEEE80211_MAX_MESH_ID_LEN }, 88 .len = IEEE80211_MAX_MESH_ID_LEN },
89 [NL80211_ATTR_MPATH_NEXT_HOP] = { .type = NLA_U32 }, 89 [NL80211_ATTR_MPATH_NEXT_HOP] = { .type = NLA_U32 },
90
91 [NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 },
92 [NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 },
93 [NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 },
90}; 94};
91 95
92/* message building helper */ 96/* message building helper */
@@ -1525,6 +1529,48 @@ static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info)
1525 return err; 1529 return err;
1526} 1530}
1527 1531
1532static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
1533{
1534 struct cfg80211_registered_device *drv;
1535 int err;
1536 struct net_device *dev;
1537 struct bss_parameters params;
1538
1539 memset(&params, 0, sizeof(params));
1540 /* default to not changing parameters */
1541 params.use_cts_prot = -1;
1542 params.use_short_preamble = -1;
1543 params.use_short_slot_time = -1;
1544
1545 if (info->attrs[NL80211_ATTR_BSS_CTS_PROT])
1546 params.use_cts_prot =
1547 nla_get_u8(info->attrs[NL80211_ATTR_BSS_CTS_PROT]);
1548 if (info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE])
1549 params.use_short_preamble =
1550 nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]);
1551 if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME])
1552 params.use_short_slot_time =
1553 nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]);
1554
1555 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1556 if (err)
1557 return err;
1558
1559 if (!drv->ops->change_bss) {
1560 err = -EOPNOTSUPP;
1561 goto out;
1562 }
1563
1564 rtnl_lock();
1565 err = drv->ops->change_bss(&drv->wiphy, dev, &params);
1566 rtnl_unlock();
1567
1568 out:
1569 cfg80211_put_dev(drv);
1570 dev_put(dev);
1571 return err;
1572}
1573
1528static struct genl_ops nl80211_ops[] = { 1574static struct genl_ops nl80211_ops[] = {
1529 { 1575 {
1530 .cmd = NL80211_CMD_GET_WIPHY, 1576 .cmd = NL80211_CMD_GET_WIPHY,
@@ -1656,6 +1702,12 @@ static struct genl_ops nl80211_ops[] = {
1656 .policy = nl80211_policy, 1702 .policy = nl80211_policy,
1657 .flags = GENL_ADMIN_PERM, 1703 .flags = GENL_ADMIN_PERM,
1658 }, 1704 },
1705 {
1706 .cmd = NL80211_CMD_SET_BSS,
1707 .doit = nl80211_set_bss,
1708 .policy = nl80211_policy,
1709 .flags = GENL_ADMIN_PERM,
1710 },
1659}; 1711};
1660 1712
1661/* multicast groups */ 1713/* multicast groups */