diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-06-02 07:01:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-06-03 14:06:14 -0400 |
commit | 1f87f7d3a3b42b20f34cb03f0fd1a41c3d0e27f3 (patch) | |
tree | 642882153a48e910a415e6bb23bcfb79fadef6dd /include | |
parent | 6081162e2ed78dfcf149b076b047078ab1445cc2 (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 'include')
-rw-r--r-- | include/asm-generic/errno.h | 2 | ||||
-rw-r--r-- | include/net/cfg80211.h | 29 | ||||
-rw-r--r-- | include/net/mac80211.h | 20 |
3 files changed, 44 insertions, 7 deletions
diff --git a/include/asm-generic/errno.h b/include/asm-generic/errno.h index e8852c092fea..28cc03bf19e6 100644 --- a/include/asm-generic/errno.h +++ b/include/asm-generic/errno.h | |||
@@ -106,4 +106,6 @@ | |||
106 | #define EOWNERDEAD 130 /* Owner died */ | 106 | #define EOWNERDEAD 130 /* Owner died */ |
107 | #define ENOTRECOVERABLE 131 /* State not recoverable */ | 107 | #define ENOTRECOVERABLE 131 /* State not recoverable */ |
108 | 108 | ||
109 | #define ERFKILL 132 /* Operation not possible due to RF-kill */ | ||
110 | |||
109 | #endif | 111 | #endif |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 8b8e4b893625..1a21895b732b 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -757,13 +757,11 @@ enum wiphy_params_flags { | |||
757 | * @TX_POWER_AUTOMATIC: the dbm parameter is ignored | 757 | * @TX_POWER_AUTOMATIC: the dbm parameter is ignored |
758 | * @TX_POWER_LIMITED: limit TX power by the dbm parameter | 758 | * @TX_POWER_LIMITED: limit TX power by the dbm parameter |
759 | * @TX_POWER_FIXED: fix TX power to the dbm parameter | 759 | * @TX_POWER_FIXED: fix TX power to the dbm parameter |
760 | * @TX_POWER_OFF: turn off completely (will go away) | ||
761 | */ | 760 | */ |
762 | enum tx_power_setting { | 761 | enum tx_power_setting { |
763 | TX_POWER_AUTOMATIC, | 762 | TX_POWER_AUTOMATIC, |
764 | TX_POWER_LIMITED, | 763 | TX_POWER_LIMITED, |
765 | TX_POWER_FIXED, | 764 | TX_POWER_FIXED, |
766 | TX_POWER_OFF, | ||
767 | }; | 765 | }; |
768 | 766 | ||
769 | /** | 767 | /** |
@@ -855,8 +853,10 @@ enum tx_power_setting { | |||
855 | * | 853 | * |
856 | * @set_tx_power: set the transmit power according to the parameters | 854 | * @set_tx_power: set the transmit power according to the parameters |
857 | * @get_tx_power: store the current TX power into the dbm variable; | 855 | * @get_tx_power: store the current TX power into the dbm variable; |
858 | * return 0 if successful; or -ENETDOWN if successful but power | 856 | * return 0 if successful |
859 | * is disabled (this will go away) | 857 | * |
858 | * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting | ||
859 | * functions to adjust rfkill hw state | ||
860 | */ | 860 | */ |
861 | struct cfg80211_ops { | 861 | struct cfg80211_ops { |
862 | int (*suspend)(struct wiphy *wiphy); | 862 | int (*suspend)(struct wiphy *wiphy); |
@@ -952,6 +952,8 @@ struct cfg80211_ops { | |||
952 | int (*set_tx_power)(struct wiphy *wiphy, | 952 | int (*set_tx_power)(struct wiphy *wiphy, |
953 | enum tx_power_setting type, int dbm); | 953 | enum tx_power_setting type, int dbm); |
954 | int (*get_tx_power)(struct wiphy *wiphy, int *dbm); | 954 | int (*get_tx_power)(struct wiphy *wiphy, int *dbm); |
955 | |||
956 | void (*rfkill_poll)(struct wiphy *wiphy); | ||
955 | }; | 957 | }; |
956 | 958 | ||
957 | /* | 959 | /* |
@@ -1666,4 +1668,23 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, | |||
1666 | */ | 1668 | */ |
1667 | void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); | 1669 | void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); |
1668 | 1670 | ||
1671 | /** | ||
1672 | * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state | ||
1673 | * @wiphy: the wiphy | ||
1674 | * @blocked: block status | ||
1675 | */ | ||
1676 | void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); | ||
1677 | |||
1678 | /** | ||
1679 | * wiphy_rfkill_start_polling - start polling rfkill | ||
1680 | * @wiphy: the wiphy | ||
1681 | */ | ||
1682 | void wiphy_rfkill_start_polling(struct wiphy *wiphy); | ||
1683 | |||
1684 | /** | ||
1685 | * wiphy_rfkill_stop_polling - stop polling rfkill | ||
1686 | * @wiphy: the wiphy | ||
1687 | */ | ||
1688 | void wiphy_rfkill_stop_polling(struct wiphy *wiphy); | ||
1689 | |||
1669 | #endif /* __NET_CFG80211_H */ | 1690 | #endif /* __NET_CFG80211_H */ |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 0270aa6e08f2..17d61d19d912 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -526,7 +526,7 @@ enum ieee80211_conf_flags { | |||
526 | /** | 526 | /** |
527 | * enum ieee80211_conf_changed - denotes which configuration changed | 527 | * enum ieee80211_conf_changed - denotes which configuration changed |
528 | * | 528 | * |
529 | * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed | 529 | * @_IEEE80211_CONF_CHANGE_RADIO_ENABLED: DEPRECATED |
530 | * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed | 530 | * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed |
531 | * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed | 531 | * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed |
532 | * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed | 532 | * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed |
@@ -536,7 +536,7 @@ enum ieee80211_conf_flags { | |||
536 | * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed | 536 | * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed |
537 | */ | 537 | */ |
538 | enum ieee80211_conf_changed { | 538 | enum ieee80211_conf_changed { |
539 | IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), | 539 | _IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), |
540 | IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), | 540 | IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), |
541 | IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), | 541 | IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), |
542 | IEEE80211_CONF_CHANGE_PS = BIT(4), | 542 | IEEE80211_CONF_CHANGE_PS = BIT(4), |
@@ -546,6 +546,14 @@ enum ieee80211_conf_changed { | |||
546 | IEEE80211_CONF_CHANGE_IDLE = BIT(8), | 546 | IEEE80211_CONF_CHANGE_IDLE = BIT(8), |
547 | }; | 547 | }; |
548 | 548 | ||
549 | static inline __deprecated enum ieee80211_conf_changed | ||
550 | __IEEE80211_CONF_CHANGE_RADIO_ENABLED(void) | ||
551 | { | ||
552 | return _IEEE80211_CONF_CHANGE_RADIO_ENABLED; | ||
553 | } | ||
554 | #define IEEE80211_CONF_CHANGE_RADIO_ENABLED \ | ||
555 | __IEEE80211_CONF_CHANGE_RADIO_ENABLED() | ||
556 | |||
549 | /** | 557 | /** |
550 | * struct ieee80211_conf - configuration of the device | 558 | * struct ieee80211_conf - configuration of the device |
551 | * | 559 | * |
@@ -585,7 +593,7 @@ struct ieee80211_conf { | |||
585 | int max_sleep_period; | 593 | int max_sleep_period; |
586 | 594 | ||
587 | u16 listen_interval; | 595 | u16 listen_interval; |
588 | bool radio_enabled; | 596 | bool __deprecated radio_enabled; |
589 | 597 | ||
590 | u8 long_frame_max_tx_count, short_frame_max_tx_count; | 598 | u8 long_frame_max_tx_count, short_frame_max_tx_count; |
591 | 599 | ||
@@ -1396,6 +1404,10 @@ enum ieee80211_ampdu_mlme_action { | |||
1396 | * is the first frame we expect to perform the action on. Notice | 1404 | * is the first frame we expect to perform the action on. Notice |
1397 | * that TX/RX_STOP can pass NULL for this parameter. | 1405 | * that TX/RX_STOP can pass NULL for this parameter. |
1398 | * Returns a negative error code on failure. | 1406 | * Returns a negative error code on failure. |
1407 | * | ||
1408 | * @rfkill_poll: Poll rfkill hardware state. If you need this, you also | ||
1409 | * need to set wiphy->rfkill_poll to %true before registration, | ||
1410 | * and need to call wiphy_rfkill_set_hw_state() in the callback. | ||
1399 | */ | 1411 | */ |
1400 | struct ieee80211_ops { | 1412 | struct ieee80211_ops { |
1401 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); | 1413 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); |
@@ -1444,6 +1456,8 @@ struct ieee80211_ops { | |||
1444 | int (*ampdu_action)(struct ieee80211_hw *hw, | 1456 | int (*ampdu_action)(struct ieee80211_hw *hw, |
1445 | enum ieee80211_ampdu_mlme_action action, | 1457 | enum ieee80211_ampdu_mlme_action action, |
1446 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); | 1458 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
1459 | |||
1460 | void (*rfkill_poll)(struct ieee80211_hw *hw); | ||
1447 | }; | 1461 | }; |
1448 | 1462 | ||
1449 | /** | 1463 | /** |