aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-06-02 07:01:41 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-06-03 14:06:14 -0400
commit1f87f7d3a3b42b20f34cb03f0fd1a41c3d0e27f3 (patch)
tree642882153a48e910a415e6bb23bcfb79fadef6dd /net/mac80211
parent6081162e2ed78dfcf149b076b047078ab1445cc2 (diff)
cfg80211: add rfkill support
To be easier on drivers and users, have cfg80211 register an rfkill structure that drivers can access. When soft-killed, simply take down all interfaces; when hard-killed the driver needs to notify us and we will take down the interfaces after the fact. While rfkilled, interfaces cannot be set UP. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c20
-rw-r--r--net/mac80211/driver-ops.h7
-rw-r--r--net/mac80211/iface.c4
-rw-r--r--net/mac80211/util.c2
4 files changed, 18 insertions, 15 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 81258acf48bc..a9211cc183cb 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1340,7 +1340,6 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy,
1340 struct ieee80211_local *local = wiphy_priv(wiphy); 1340 struct ieee80211_local *local = wiphy_priv(wiphy);
1341 struct ieee80211_channel *chan = local->hw.conf.channel; 1341 struct ieee80211_channel *chan = local->hw.conf.channel;
1342 u32 changes = 0; 1342 u32 changes = 0;
1343 bool radio_enabled = true;
1344 1343
1345 switch (type) { 1344 switch (type) {
1346 case TX_POWER_AUTOMATIC: 1345 case TX_POWER_AUTOMATIC:
@@ -1359,14 +1358,6 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy,
1359 return -EINVAL; 1358 return -EINVAL;
1360 local->user_power_level = dbm; 1359 local->user_power_level = dbm;
1361 break; 1360 break;
1362 case TX_POWER_OFF:
1363 radio_enabled = false;
1364 break;
1365 }
1366
1367 if (radio_enabled != local->hw.conf.radio_enabled) {
1368 changes |= IEEE80211_CONF_CHANGE_RADIO_ENABLED;
1369 local->hw.conf.radio_enabled = radio_enabled;
1370 } 1361 }
1371 1362
1372 ieee80211_hw_config(local, changes); 1363 ieee80211_hw_config(local, changes);
@@ -1380,12 +1371,16 @@ static int ieee80211_get_tx_power(struct wiphy *wiphy, int *dbm)
1380 1371
1381 *dbm = local->hw.conf.power_level; 1372 *dbm = local->hw.conf.power_level;
1382 1373
1383 if (!local->hw.conf.radio_enabled)
1384 return -ENETDOWN;
1385
1386 return 0; 1374 return 0;
1387} 1375}
1388 1376
1377static void ieee80211_rfkill_poll(struct wiphy *wiphy)
1378{
1379 struct ieee80211_local *local = wiphy_priv(wiphy);
1380
1381 drv_rfkill_poll(local);
1382}
1383
1389struct cfg80211_ops mac80211_config_ops = { 1384struct cfg80211_ops mac80211_config_ops = {
1390 .add_virtual_intf = ieee80211_add_iface, 1385 .add_virtual_intf = ieee80211_add_iface,
1391 .del_virtual_intf = ieee80211_del_iface, 1386 .del_virtual_intf = ieee80211_del_iface,
@@ -1427,4 +1422,5 @@ struct cfg80211_ops mac80211_config_ops = {
1427 .set_wiphy_params = ieee80211_set_wiphy_params, 1422 .set_wiphy_params = ieee80211_set_wiphy_params,
1428 .set_tx_power = ieee80211_set_tx_power, 1423 .set_tx_power = ieee80211_set_tx_power,
1429 .get_tx_power = ieee80211_get_tx_power, 1424 .get_tx_power = ieee80211_get_tx_power,
1425 .rfkill_poll = ieee80211_rfkill_poll,
1430}; 1426};
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 3912b5334b9c..b13446afd48f 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -181,4 +181,11 @@ static inline int drv_ampdu_action(struct ieee80211_local *local,
181 sta, tid, ssn); 181 sta, tid, ssn);
182 return -EOPNOTSUPP; 182 return -EOPNOTSUPP;
183} 183}
184
185
186static inline void drv_rfkill_poll(struct ieee80211_local *local)
187{
188 if (local->ops->rfkill_poll)
189 local->ops->rfkill_poll(&local->hw);
190}
184#endif /* __MAC80211_DRIVER_OPS */ 191#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 8c9f1c722cdb..b7c8a4484298 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -170,7 +170,7 @@ static int ieee80211_open(struct net_device *dev)
170 goto err_del_bss; 170 goto err_del_bss;
171 /* we're brought up, everything changes */ 171 /* we're brought up, everything changes */
172 hw_reconf_flags = ~0; 172 hw_reconf_flags = ~0;
173 ieee80211_led_radio(local, local->hw.conf.radio_enabled); 173 ieee80211_led_radio(local, true);
174 } 174 }
175 175
176 /* 176 /*
@@ -560,7 +560,7 @@ static int ieee80211_stop(struct net_device *dev)
560 560
561 drv_stop(local); 561 drv_stop(local);
562 562
563 ieee80211_led_radio(local, 0); 563 ieee80211_led_radio(local, false);
564 564
565 flush_workqueue(local->hw.workqueue); 565 flush_workqueue(local->hw.workqueue);
566 566
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 31284c984e38..22f63815fb36 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -973,7 +973,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
973 if (local->open_count) { 973 if (local->open_count) {
974 res = drv_start(local); 974 res = drv_start(local);
975 975
976 ieee80211_led_radio(local, hw->conf.radio_enabled); 976 ieee80211_led_radio(local, true);
977 } 977 }
978 978
979 /* add interfaces */ 979 /* add interfaces */