aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-06-02 15:39:54 -0400
committerJohannes Berg <johannes.berg@intel.com>2015-06-10 10:05:36 -0400
commit30686bf7f5b3c30831761e188a6e3cb33580fa48 (patch)
tree65be6b3ae5d661bf076af64855555f562fe356fd /net
parent206c59d1d7d42bcafc1d7f1e476e87e4427e2345 (diff)
mac80211: convert HW flags to unsigned long bitmap
As we're running out of hardware capability flags pretty quickly, convert them to use the regular test_bit() style unsigned long bitmaps. This introduces a number of helper functions/macros to set and to test the bits, along with new debugfs code. The occurrences of an explicit __clear_bit() are intentional, the drivers were never supposed to change their supported bits on the fly. We should investigate changing this to be a per-frame flag. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/agg-tx.c4
-rw-r--r--net/mac80211/cfg.c10
-rw-r--r--net/mac80211/debugfs.c96
-rw-r--r--net/mac80211/driver-ops.h2
-rw-r--r--net/mac80211/iface.c10
-rw-r--r--net/mac80211/key.c4
-rw-r--r--net/mac80211/main.c14
-rw-r--r--net/mac80211/mlme.c63
-rw-r--r--net/mac80211/offchannel.c2
-rw-r--r--net/mac80211/pm.c4
-rw-r--r--net/mac80211/rate.c6
-rw-r--r--net/mac80211/rc80211_minstrel_ht.c2
-rw-r--r--net/mac80211/rx.c26
-rw-r--r--net/mac80211/scan.c10
-rw-r--r--net/mac80211/sta_info.c14
-rw-r--r--net/mac80211/status.c13
-rw-r--r--net/mac80211/tdls.c2
-rw-r--r--net/mac80211/tx.c34
-rw-r--r--net/mac80211/util.c6
19 files changed, 164 insertions, 158 deletions
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index cce9d425c718..c8ba2e77737c 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -564,8 +564,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
564 return -EINVAL; 564 return -EINVAL;
565 565
566 if ((tid >= IEEE80211_NUM_TIDS) || 566 if ((tid >= IEEE80211_NUM_TIDS) ||
567 !(local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION) || 567 !ieee80211_hw_check(&local->hw, AMPDU_AGGREGATION) ||
568 (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW)) 568 ieee80211_hw_check(&local->hw, TX_AMPDU_SETUP_IN_HW))
569 return -EINVAL; 569 return -EINVAL;
570 570
571 ht_dbg(sdata, "Open BA session requested for %pM tid %u\n", 571 ht_dbg(sdata, "Open BA session requested for %pM tid %u\n",
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 1d01190535b0..bf7023f6c327 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1763,7 +1763,7 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy,
1763 /* our RSSI threshold implementation is supported only for 1763 /* our RSSI threshold implementation is supported only for
1764 * devices that report signal in dBm. 1764 * devices that report signal in dBm.
1765 */ 1765 */
1766 if (!(sdata->local->hw.flags & IEEE80211_HW_SIGNAL_DBM)) 1766 if (!ieee80211_hw_check(&sdata->local->hw, SIGNAL_DBM))
1767 return -ENOTSUPP; 1767 return -ENOTSUPP;
1768 conf->rssi_threshold = nconf->rssi_threshold; 1768 conf->rssi_threshold = nconf->rssi_threshold;
1769 } 1769 }
@@ -2407,7 +2407,7 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
2407 if (sdata->vif.type != NL80211_IFTYPE_STATION) 2407 if (sdata->vif.type != NL80211_IFTYPE_STATION)
2408 return -EOPNOTSUPP; 2408 return -EOPNOTSUPP;
2409 2409
2410 if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) 2410 if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS))
2411 return -EOPNOTSUPP; 2411 return -EOPNOTSUPP;
2412 2412
2413 if (enabled == sdata->u.mgd.powersave && 2413 if (enabled == sdata->u.mgd.powersave &&
@@ -2422,7 +2422,7 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
2422 __ieee80211_request_smps_mgd(sdata, sdata->u.mgd.req_smps); 2422 __ieee80211_request_smps_mgd(sdata, sdata->u.mgd.req_smps);
2423 sdata_unlock(sdata); 2423 sdata_unlock(sdata);
2424 2424
2425 if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) 2425 if (ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS))
2426 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); 2426 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
2427 2427
2428 ieee80211_recalc_ps(local, -1); 2428 ieee80211_recalc_ps(local, -1);
@@ -2466,7 +2466,7 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
2466 if (!ieee80211_sdata_running(sdata)) 2466 if (!ieee80211_sdata_running(sdata))
2467 return -ENETDOWN; 2467 return -ENETDOWN;
2468 2468
2469 if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) { 2469 if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) {
2470 ret = drv_set_bitrate_mask(local, sdata, mask); 2470 ret = drv_set_bitrate_mask(local, sdata, mask);
2471 if (ret) 2471 if (ret)
2472 return ret; 2472 return ret;
@@ -3451,7 +3451,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
3451 3451
3452 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_TX_OFFCHAN | 3452 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_TX_OFFCHAN |
3453 IEEE80211_TX_INTFL_OFFCHAN_TX_OK; 3453 IEEE80211_TX_INTFL_OFFCHAN_TX_OK;
3454 if (local->hw.flags & IEEE80211_HW_QUEUE_CONTROL) 3454 if (ieee80211_hw_check(&local->hw, QUEUE_CONTROL))
3455 IEEE80211_SKB_CB(skb)->hw_queue = 3455 IEEE80211_SKB_CB(skb)->hw_queue =
3456 local->hw.offchannel_tx_hw_queue; 3456 local->hw.offchannel_tx_hw_queue;
3457 3457
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 1b94d2704c27..3ea8b7de9633 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -91,56 +91,66 @@ static const struct file_operations reset_ops = {
91}; 91};
92#endif 92#endif
93 93
94static const char *hw_flag_names[NUM_IEEE80211_HW_FLAGS + 1] = {
95#define FLAG(F) [IEEE80211_HW_##F] = #F
96 FLAG(HAS_RATE_CONTROL),
97 FLAG(RX_INCLUDES_FCS),
98 FLAG(HOST_BROADCAST_PS_BUFFERING),
99 FLAG(SIGNAL_UNSPEC),
100 FLAG(SIGNAL_DBM),
101 FLAG(NEED_DTIM_BEFORE_ASSOC),
102 FLAG(SPECTRUM_MGMT),
103 FLAG(AMPDU_AGGREGATION),
104 FLAG(SUPPORTS_PS),
105 FLAG(PS_NULLFUNC_STACK),
106 FLAG(SUPPORTS_DYNAMIC_PS),
107 FLAG(MFP_CAPABLE),
108 FLAG(WANT_MONITOR_VIF),
109 FLAG(NO_AUTO_VIF),
110 FLAG(SW_CRYPTO_CONTROL),
111 FLAG(SUPPORT_FAST_XMIT),
112 FLAG(REPORTS_TX_ACK_STATUS),
113 FLAG(CONNECTION_MONITOR),
114 FLAG(QUEUE_CONTROL),
115 FLAG(SUPPORTS_PER_STA_GTK),
116 FLAG(AP_LINK_PS),
117 FLAG(TX_AMPDU_SETUP_IN_HW),
118 FLAG(SUPPORTS_RC_TABLE),
119 FLAG(P2P_DEV_ADDR_FOR_INTF),
120 FLAG(TIMING_BEACON_ONLY),
121 FLAG(SUPPORTS_HT_CCK_RATES),
122 FLAG(CHANCTX_STA_CSA),
123 FLAG(SUPPORTS_CLONED_SKBS),
124 FLAG(SINGLE_SCAN_ON_ALL_BANDS),
125
126 /* keep last for the build bug below */
127 (void *)0x1
128#undef FLAG
129};
130
94static ssize_t hwflags_read(struct file *file, char __user *user_buf, 131static ssize_t hwflags_read(struct file *file, char __user *user_buf,
95 size_t count, loff_t *ppos) 132 size_t count, loff_t *ppos)
96{ 133{
97 struct ieee80211_local *local = file->private_data; 134 struct ieee80211_local *local = file->private_data;
98 int mxln = 500; 135 size_t bufsz = 30 * NUM_IEEE80211_HW_FLAGS;
136 char *buf = kzalloc(bufsz, GFP_KERNEL);
137 char *pos = buf, *end = buf + bufsz - 1;
99 ssize_t rv; 138 ssize_t rv;
100 char *buf = kzalloc(mxln, GFP_KERNEL); 139 int i;
101 int sf = 0; /* how many written so far */
102 140
103 if (!buf) 141 if (!buf)
104 return 0; 142 return -ENOMEM;
105 143
106 sf += scnprintf(buf, mxln - sf, "0x%x\n", local->hw.flags); 144 /* fail compilation if somebody adds or removes
107 if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) 145 * a flag without updating the name array above
108 sf += scnprintf(buf + sf, mxln - sf, "HAS_RATE_CONTROL\n"); 146 */
109 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) 147 BUILD_BUG_ON(hw_flag_names[NUM_IEEE80211_HW_FLAGS] != (void *)0x1);
110 sf += scnprintf(buf + sf, mxln - sf, "RX_INCLUDES_FCS\n"); 148
111 if (local->hw.flags & IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING) 149 for (i = 0; i < NUM_IEEE80211_HW_FLAGS; i++) {
112 sf += scnprintf(buf + sf, mxln - sf, 150 if (test_bit(i, local->hw.flags))
113 "HOST_BCAST_PS_BUFFERING\n"); 151 pos += scnprintf(pos, end - pos, "%s",
114 if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) 152 hw_flag_names[i]);
115 sf += scnprintf(buf + sf, mxln - sf, "SIGNAL_UNSPEC\n"); 153 }
116 if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
117 sf += scnprintf(buf + sf, mxln - sf, "SIGNAL_DBM\n");
118 if (local->hw.flags & IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC)
119 sf += scnprintf(buf + sf, mxln - sf,
120 "NEED_DTIM_BEFORE_ASSOC\n");
121 if (local->hw.flags & IEEE80211_HW_SPECTRUM_MGMT)
122 sf += scnprintf(buf + sf, mxln - sf, "SPECTRUM_MGMT\n");
123 if (local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION)
124 sf += scnprintf(buf + sf, mxln - sf, "AMPDU_AGGREGATION\n");
125 if (local->hw.flags & IEEE80211_HW_SUPPORTS_PS)
126 sf += scnprintf(buf + sf, mxln - sf, "SUPPORTS_PS\n");
127 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
128 sf += scnprintf(buf + sf, mxln - sf, "PS_NULLFUNC_STACK\n");
129 if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)
130 sf += scnprintf(buf + sf, mxln - sf, "SUPPORTS_DYNAMIC_PS\n");
131 if (local->hw.flags & IEEE80211_HW_MFP_CAPABLE)
132 sf += scnprintf(buf + sf, mxln - sf, "MFP_CAPABLE\n");
133 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)
134 sf += scnprintf(buf + sf, mxln - sf,
135 "REPORTS_TX_ACK_STATUS\n");
136 if (local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR)
137 sf += scnprintf(buf + sf, mxln - sf, "CONNECTION_MONITOR\n");
138 if (local->hw.flags & IEEE80211_HW_SUPPORTS_PER_STA_GTK)
139 sf += scnprintf(buf + sf, mxln - sf, "SUPPORTS_PER_STA_GTK\n");
140 if (local->hw.flags & IEEE80211_HW_AP_LINK_PS)
141 sf += scnprintf(buf + sf, mxln - sf, "AP_LINK_PS\n");
142 if (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW)
143 sf += scnprintf(buf + sf, mxln - sf, "TX_AMPDU_SETUP_IN_HW\n");
144 154
145 rv = simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); 155 rv = simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
146 kfree(buf); 156 kfree(buf);
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index c01e681b90fb..32a2e707e222 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -146,7 +146,7 @@ static inline int drv_add_interface(struct ieee80211_local *local,
146 146
147 if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN || 147 if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
148 (sdata->vif.type == NL80211_IFTYPE_MONITOR && 148 (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
149 !(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF) && 149 !ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF) &&
150 !(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE)))) 150 !(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE))))
151 return -EINVAL; 151 return -EINVAL;
152 152
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index b2e85ffca7ed..ed1edac14372 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -338,7 +338,7 @@ static int ieee80211_check_queues(struct ieee80211_sub_if_data *sdata,
338 if ((iftype != NL80211_IFTYPE_AP && 338 if ((iftype != NL80211_IFTYPE_AP &&
339 iftype != NL80211_IFTYPE_P2P_GO && 339 iftype != NL80211_IFTYPE_P2P_GO &&
340 iftype != NL80211_IFTYPE_MESH_POINT) || 340 iftype != NL80211_IFTYPE_MESH_POINT) ||
341 !(sdata->local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)) { 341 !ieee80211_hw_check(&sdata->local->hw, QUEUE_CONTROL)) {
342 sdata->vif.cab_queue = IEEE80211_INVAL_HW_QUEUE; 342 sdata->vif.cab_queue = IEEE80211_INVAL_HW_QUEUE;
343 return 0; 343 return 0;
344 } 344 }
@@ -378,7 +378,7 @@ static void ieee80211_set_default_queues(struct ieee80211_sub_if_data *sdata)
378 int i; 378 int i;
379 379
380 for (i = 0; i < IEEE80211_NUM_ACS; i++) { 380 for (i = 0; i < IEEE80211_NUM_ACS; i++) {
381 if (local->hw.flags & IEEE80211_HW_QUEUE_CONTROL) 381 if (ieee80211_hw_check(&local->hw, QUEUE_CONTROL))
382 sdata->vif.hw_queue[i] = IEEE80211_INVAL_HW_QUEUE; 382 sdata->vif.hw_queue[i] = IEEE80211_INVAL_HW_QUEUE;
383 else if (local->hw.queues >= IEEE80211_NUM_ACS) 383 else if (local->hw.queues >= IEEE80211_NUM_ACS)
384 sdata->vif.hw_queue[i] = i; 384 sdata->vif.hw_queue[i] = i;
@@ -393,7 +393,7 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
393 struct ieee80211_sub_if_data *sdata; 393 struct ieee80211_sub_if_data *sdata;
394 int ret; 394 int ret;
395 395
396 if (!(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF)) 396 if (!ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF))
397 return 0; 397 return 0;
398 398
399 ASSERT_RTNL(); 399 ASSERT_RTNL();
@@ -454,7 +454,7 @@ void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
454{ 454{
455 struct ieee80211_sub_if_data *sdata; 455 struct ieee80211_sub_if_data *sdata;
456 456
457 if (!(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF)) 457 if (!ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF))
458 return; 458 return;
459 459
460 ASSERT_RTNL(); 460 ASSERT_RTNL();
@@ -1586,7 +1586,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
1586 break; 1586 break;
1587 case NL80211_IFTYPE_P2P_CLIENT: 1587 case NL80211_IFTYPE_P2P_CLIENT:
1588 case NL80211_IFTYPE_P2P_GO: 1588 case NL80211_IFTYPE_P2P_GO:
1589 if (local->hw.flags & IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF) { 1589 if (ieee80211_hw_check(&local->hw, P2P_DEV_ADDR_FOR_INTF)) {
1590 list_for_each_entry(sdata, &local->interfaces, list) { 1590 list_for_each_entry(sdata, &local->interfaces, list) {
1591 if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE) 1591 if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE)
1592 continue; 1592 continue;
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index b9aac809628f..8abc31ebcf61 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -147,7 +147,7 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
147 * is supported; if not, return. 147 * is supported; if not, return.
148 */ 148 */
149 if (sta && !(key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE) && 149 if (sta && !(key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE) &&
150 !(key->local->hw.flags & IEEE80211_HW_SUPPORTS_PER_STA_GTK)) 150 !ieee80211_hw_check(&key->local->hw, SUPPORTS_PER_STA_GTK))
151 goto out_unsupported; 151 goto out_unsupported;
152 152
153 if (sta && !sta->uploaded) 153 if (sta && !sta->uploaded)
@@ -201,7 +201,7 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
201 /* all of these we can do in software - if driver can */ 201 /* all of these we can do in software - if driver can */
202 if (ret == 1) 202 if (ret == 1)
203 return 0; 203 return 0;
204 if (key->local->hw.flags & IEEE80211_HW_SW_CRYPTO_CONTROL) 204 if (ieee80211_hw_check(&key->local->hw, SW_CRYPTO_CONTROL))
205 return -EINVAL; 205 return -EINVAL;
206 return 0; 206 return 0;
207 default: 207 default:
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 674164fe5cdb..3c63468b4dfb 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -661,7 +661,7 @@ static int ieee80211_init_cipher_suites(struct ieee80211_local *local)
661{ 661{
662 bool have_wep = !(IS_ERR(local->wep_tx_tfm) || 662 bool have_wep = !(IS_ERR(local->wep_tx_tfm) ||
663 IS_ERR(local->wep_rx_tfm)); 663 IS_ERR(local->wep_rx_tfm));
664 bool have_mfp = local->hw.flags & IEEE80211_HW_MFP_CAPABLE; 664 bool have_mfp = ieee80211_hw_check(&local->hw, MFP_CAPABLE);
665 int n_suites = 0, r = 0, w = 0; 665 int n_suites = 0, r = 0, w = 0;
666 u32 *suites; 666 u32 *suites;
667 static const u32 cipher_suites[] = { 667 static const u32 cipher_suites[] = {
@@ -681,7 +681,7 @@ static int ieee80211_init_cipher_suites(struct ieee80211_local *local)
681 WLAN_CIPHER_SUITE_BIP_GMAC_256, 681 WLAN_CIPHER_SUITE_BIP_GMAC_256,
682 }; 682 };
683 683
684 if (local->hw.flags & IEEE80211_HW_SW_CRYPTO_CONTROL || 684 if (ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL) ||
685 local->hw.wiphy->cipher_suites) { 685 local->hw.wiphy->cipher_suites) {
686 /* If the driver advertises, or doesn't support SW crypto, 686 /* If the driver advertises, or doesn't support SW crypto,
687 * we only need to remove WEP if necessary. 687 * we only need to remove WEP if necessary.
@@ -797,7 +797,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
797 netdev_features_t feature_whitelist; 797 netdev_features_t feature_whitelist;
798 struct cfg80211_chan_def dflt_chandef = {}; 798 struct cfg80211_chan_def dflt_chandef = {};
799 799
800 if (hw->flags & IEEE80211_HW_QUEUE_CONTROL && 800 if (ieee80211_hw_check(hw, QUEUE_CONTROL) &&
801 (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE || 801 (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE ||
802 local->hw.offchannel_tx_hw_queue >= local->hw.queues)) 802 local->hw.offchannel_tx_hw_queue >= local->hw.queues))
803 return -EINVAL; 803 return -EINVAL;
@@ -945,9 +945,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
945 /* mac80211 supports control port protocol changing */ 945 /* mac80211 supports control port protocol changing */
946 local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL; 946 local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL;
947 947
948 if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) { 948 if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) {
949 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; 949 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
950 } else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) { 950 } else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC)) {
951 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; 951 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
952 if (hw->max_signal <= 0) { 952 if (hw->max_signal <= 0) {
953 result = -EINVAL; 953 result = -EINVAL;
@@ -1001,7 +1001,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
1001 local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP; 1001 local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
1002 1002
1003 /* mac80211 supports eCSA, if the driver supports STA CSA at all */ 1003 /* mac80211 supports eCSA, if the driver supports STA CSA at all */
1004 if (local->hw.flags & IEEE80211_HW_CHANCTX_STA_CSA) 1004 if (ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA))
1005 local->ext_capa[0] |= WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING; 1005 local->ext_capa[0] |= WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING;
1006 1006
1007 local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CSA_COUNTERS_NUM; 1007 local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CSA_COUNTERS_NUM;
@@ -1069,7 +1069,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
1069 1069
1070 /* add one default STA interface if supported */ 1070 /* add one default STA interface if supported */
1071 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) && 1071 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) &&
1072 !(hw->flags & IEEE80211_HW_NO_AUTO_VIF)) { 1072 !ieee80211_hw_check(hw, NO_AUTO_VIF)) {
1073 result = ieee80211_if_add(local, "wlan%d", NET_NAME_ENUM, NULL, 1073 result = ieee80211_if_add(local, "wlan%d", NET_NAME_ENUM, NULL,
1074 NL80211_IFTYPE_STATION, NULL); 1074 NL80211_IFTYPE_STATION, NULL);
1075 if (result) 1075 if (result)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 235ed68dca36..9b2cc278ac2a 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -118,7 +118,7 @@ void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata)
118 if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) 118 if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER)
119 return; 119 return;
120 120
121 if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) 121 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
122 return; 122 return;
123 123
124 mod_timer(&sdata->u.mgd.bcn_mon_timer, 124 mod_timer(&sdata->u.mgd.bcn_mon_timer,
@@ -134,7 +134,7 @@ void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata)
134 134
135 ifmgd->probe_send_count = 0; 135 ifmgd->probe_send_count = 0;
136 136
137 if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) 137 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
138 return; 138 return;
139 139
140 mod_timer(&sdata->u.mgd.conn_mon_timer, 140 mod_timer(&sdata->u.mgd.conn_mon_timer,
@@ -677,7 +677,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
677 capab |= WLAN_CAPABILITY_PRIVACY; 677 capab |= WLAN_CAPABILITY_PRIVACY;
678 678
679 if ((assoc_data->capability & WLAN_CAPABILITY_SPECTRUM_MGMT) && 679 if ((assoc_data->capability & WLAN_CAPABILITY_SPECTRUM_MGMT) &&
680 (local->hw.flags & IEEE80211_HW_SPECTRUM_MGMT)) 680 ieee80211_hw_check(&local->hw, SPECTRUM_MGMT))
681 capab |= WLAN_CAPABILITY_SPECTRUM_MGMT; 681 capab |= WLAN_CAPABILITY_SPECTRUM_MGMT;
682 682
683 if (ifmgd->flags & IEEE80211_STA_ENABLE_RRM) 683 if (ifmgd->flags & IEEE80211_STA_ENABLE_RRM)
@@ -885,7 +885,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
885 drv_mgd_prepare_tx(local, sdata); 885 drv_mgd_prepare_tx(local, sdata);
886 886
887 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; 887 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
888 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 888 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
889 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS | 889 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS |
890 IEEE80211_TX_INTFL_MLME_CONN_TX; 890 IEEE80211_TX_INTFL_MLME_CONN_TX;
891 ieee80211_tx_skb(sdata, skb); 891 ieee80211_tx_skb(sdata, skb);
@@ -927,7 +927,7 @@ void ieee80211_send_nullfunc(struct ieee80211_local *local,
927 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | 927 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
928 IEEE80211_TX_INTFL_OFFCHAN_TX_OK; 928 IEEE80211_TX_INTFL_OFFCHAN_TX_OK;
929 929
930 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 930 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
931 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; 931 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
932 932
933 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) 933 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL)
@@ -1198,7 +1198,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
1198 chanctx = container_of(conf, struct ieee80211_chanctx, conf); 1198 chanctx = container_of(conf, struct ieee80211_chanctx, conf);
1199 1199
1200 if (local->use_chanctx && 1200 if (local->use_chanctx &&
1201 !(local->hw.flags & IEEE80211_HW_CHANCTX_STA_CSA)) { 1201 !ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA)) {
1202 sdata_info(sdata, 1202 sdata_info(sdata,
1203 "driver doesn't support chan-switch with channel contexts\n"); 1203 "driver doesn't support chan-switch with channel contexts\n");
1204 goto drop_connection; 1204 goto drop_connection;
@@ -1407,15 +1407,15 @@ static void ieee80211_enable_ps(struct ieee80211_local *local,
1407 return; 1407 return;
1408 1408
1409 if (conf->dynamic_ps_timeout > 0 && 1409 if (conf->dynamic_ps_timeout > 0 &&
1410 !(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)) { 1410 !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) {
1411 mod_timer(&local->dynamic_ps_timer, jiffies + 1411 mod_timer(&local->dynamic_ps_timer, jiffies +
1412 msecs_to_jiffies(conf->dynamic_ps_timeout)); 1412 msecs_to_jiffies(conf->dynamic_ps_timeout));
1413 } else { 1413 } else {
1414 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) 1414 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK))
1415 ieee80211_send_nullfunc(local, sdata, 1); 1415 ieee80211_send_nullfunc(local, sdata, 1);
1416 1416
1417 if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) && 1417 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) &&
1418 (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)) 1418 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
1419 return; 1419 return;
1420 1420
1421 conf->flags |= IEEE80211_CONF_PS; 1421 conf->flags |= IEEE80211_CONF_PS;
@@ -1474,7 +1474,7 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
1474 int count = 0; 1474 int count = 0;
1475 int timeout; 1475 int timeout;
1476 1476
1477 if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) { 1477 if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS)) {
1478 local->ps_sdata = NULL; 1478 local->ps_sdata = NULL;
1479 return; 1479 return;
1480 } 1480 }
@@ -1620,7 +1620,7 @@ void ieee80211_dynamic_ps_enable_work(struct work_struct *work)
1620 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); 1620 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
1621 } 1621 }
1622 1622
1623 if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) && 1623 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) &&
1624 !(ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { 1624 !(ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) {
1625 if (drv_tx_frames_pending(local)) { 1625 if (drv_tx_frames_pending(local)) {
1626 mod_timer(&local->dynamic_ps_timer, jiffies + 1626 mod_timer(&local->dynamic_ps_timer, jiffies +
@@ -1633,8 +1633,8 @@ void ieee80211_dynamic_ps_enable_work(struct work_struct *work)
1633 } 1633 }
1634 } 1634 }
1635 1635
1636 if (!((local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) && 1636 if (!(ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS) &&
1637 (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)) || 1637 ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) ||
1638 (ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { 1638 (ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) {
1639 ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; 1639 ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED;
1640 local->hw.conf.flags |= IEEE80211_CONF_PS; 1640 local->hw.conf.flags |= IEEE80211_CONF_PS;
@@ -2159,7 +2159,7 @@ static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata)
2159 ieee80211_recalc_ps(local, -1); 2159 ieee80211_recalc_ps(local, -1);
2160 mutex_unlock(&local->iflist_mtx); 2160 mutex_unlock(&local->iflist_mtx);
2161 2161
2162 if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) 2162 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
2163 goto out; 2163 goto out;
2164 2164
2165 /* 2165 /*
@@ -2257,7 +2257,7 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
2257 */ 2257 */
2258 ifmgd->probe_send_count++; 2258 ifmgd->probe_send_count++;
2259 2259
2260 if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { 2260 if (ieee80211_hw_check(&sdata->local->hw, REPORTS_TX_ACK_STATUS)) {
2261 ifmgd->nullfunc_failed = false; 2261 ifmgd->nullfunc_failed = false;
2262 ieee80211_send_nullfunc(sdata->local, sdata, 0); 2262 ieee80211_send_nullfunc(sdata->local, sdata, 0);
2263 } else { 2263 } else {
@@ -2562,7 +2562,7 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
2562 return; 2562 return;
2563 auth_data->expected_transaction = 4; 2563 auth_data->expected_transaction = 4;
2564 drv_mgd_prepare_tx(sdata->local, sdata); 2564 drv_mgd_prepare_tx(sdata->local, sdata);
2565 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 2565 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
2566 tx_flags = IEEE80211_TX_CTL_REQ_TX_STATUS | 2566 tx_flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
2567 IEEE80211_TX_INTFL_MLME_CONN_TX; 2567 IEEE80211_TX_INTFL_MLME_CONN_TX;
2568 ieee80211_send_auth(sdata, 3, auth_data->algorithm, 0, 2568 ieee80211_send_auth(sdata, 3, auth_data->algorithm, 0,
@@ -3337,7 +3337,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
3337 } 3337 }
3338 ifmgd->have_beacon = true; 3338 ifmgd->have_beacon = true;
3339 ifmgd->assoc_data->need_beacon = false; 3339 ifmgd->assoc_data->need_beacon = false;
3340 if (local->hw.flags & IEEE80211_HW_TIMING_BEACON_ONLY) { 3340 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY)) {
3341 sdata->vif.bss_conf.sync_tsf = 3341 sdata->vif.bss_conf.sync_tsf =
3342 le64_to_cpu(mgmt->u.beacon.timestamp); 3342 le64_to_cpu(mgmt->u.beacon.timestamp);
3343 sdata->vif.bss_conf.sync_device_ts = 3343 sdata->vif.bss_conf.sync_device_ts =
@@ -3443,7 +3443,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
3443 len - baselen, false, &elems, 3443 len - baselen, false, &elems,
3444 care_about_ies, ncrc); 3444 care_about_ies, ncrc);
3445 3445
3446 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) { 3446 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) {
3447 bool directed_tim = ieee80211_check_tim(elems.tim, 3447 bool directed_tim = ieee80211_check_tim(elems.tim,
3448 elems.tim_len, 3448 elems.tim_len,
3449 ifmgd->aid); 3449 ifmgd->aid);
@@ -3511,7 +3511,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
3511 * the driver will use them. The synchronized view is currently 3511 * the driver will use them. The synchronized view is currently
3512 * guaranteed only in certain callbacks. 3512 * guaranteed only in certain callbacks.
3513 */ 3513 */
3514 if (local->hw.flags & IEEE80211_HW_TIMING_BEACON_ONLY) { 3514 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY)) {
3515 sdata->vif.bss_conf.sync_tsf = 3515 sdata->vif.bss_conf.sync_tsf =
3516 le64_to_cpu(mgmt->u.beacon.timestamp); 3516 le64_to_cpu(mgmt->u.beacon.timestamp);
3517 sdata->vif.bss_conf.sync_device_ts = 3517 sdata->vif.bss_conf.sync_device_ts =
@@ -3749,7 +3749,7 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
3749 auth_data->expected_transaction = trans; 3749 auth_data->expected_transaction = trans;
3750 } 3750 }
3751 3751
3752 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 3752 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
3753 tx_flags = IEEE80211_TX_CTL_REQ_TX_STATUS | 3753 tx_flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
3754 IEEE80211_TX_INTFL_MLME_CONN_TX; 3754 IEEE80211_TX_INTFL_MLME_CONN_TX;
3755 3755
@@ -3822,7 +3822,7 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata)
3822 IEEE80211_ASSOC_MAX_TRIES); 3822 IEEE80211_ASSOC_MAX_TRIES);
3823 ieee80211_send_assoc(sdata); 3823 ieee80211_send_assoc(sdata);
3824 3824
3825 if (!(local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)) { 3825 if (!ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
3826 assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; 3826 assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT;
3827 assoc_data->timeout_started = true; 3827 assoc_data->timeout_started = true;
3828 run_again(sdata, assoc_data->timeout); 3828 run_again(sdata, assoc_data->timeout);
@@ -3936,7 +3936,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
3936 3936
3937 memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); 3937 memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
3938 3938
3939 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 3939 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
3940 max_tries = max_nullfunc_tries; 3940 max_tries = max_nullfunc_tries;
3941 else 3941 else
3942 max_tries = max_probe_tries; 3942 max_tries = max_probe_tries;
@@ -3961,7 +3961,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
3961 } 3961 }
3962 } else if (time_is_after_jiffies(ifmgd->probe_timeout)) 3962 } else if (time_is_after_jiffies(ifmgd->probe_timeout))
3963 run_again(sdata, ifmgd->probe_timeout); 3963 run_again(sdata, ifmgd->probe_timeout);
3964 else if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { 3964 else if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
3965 mlme_dbg(sdata, 3965 mlme_dbg(sdata,
3966 "Failed to send nullfunc to AP %pM after %dms, disconnecting\n", 3966 "Failed to send nullfunc to AP %pM after %dms, disconnecting\n",
3967 bssid, probe_wait_ms); 3967 bssid, probe_wait_ms);
@@ -4030,14 +4030,11 @@ static void ieee80211_sta_monitor_work(struct work_struct *work)
4030 4030
4031static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) 4031static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
4032{ 4032{
4033 u32 flags;
4034
4035 if (sdata->vif.type == NL80211_IFTYPE_STATION) { 4033 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
4036 __ieee80211_stop_poll(sdata); 4034 __ieee80211_stop_poll(sdata);
4037 4035
4038 /* let's probe the connection once */ 4036 /* let's probe the connection once */
4039 flags = sdata->local->hw.flags; 4037 if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
4040 if (!(flags & IEEE80211_HW_CONNECTION_MONITOR))
4041 ieee80211_queue_work(&sdata->local->hw, 4038 ieee80211_queue_work(&sdata->local->hw,
4042 &sdata->u.mgd.monitor_work); 4039 &sdata->u.mgd.monitor_work);
4043 /* and do all the other regular work too */ 4040 /* and do all the other regular work too */
@@ -4450,8 +4447,8 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
4450 sdata->vif.bss_conf.sync_dtim_count = tim_ie[2]; 4447 sdata->vif.bss_conf.sync_dtim_count = tim_ie[2];
4451 else 4448 else
4452 sdata->vif.bss_conf.sync_dtim_count = 0; 4449 sdata->vif.bss_conf.sync_dtim_count = 0;
4453 } else if (!(local->hw.flags & 4450 } else if (!ieee80211_hw_check(&sdata->local->hw,
4454 IEEE80211_HW_TIMING_BEACON_ONLY)) { 4451 TIMING_BEACON_ONLY)) {
4455 ies = rcu_dereference(cbss->proberesp_ies); 4452 ies = rcu_dereference(cbss->proberesp_ies);
4456 /* must be non-NULL since beacon IEs were NULL */ 4453 /* must be non-NULL since beacon IEs were NULL */
4457 sdata->vif.bss_conf.sync_tsf = ies->tsf; 4454 sdata->vif.bss_conf.sync_tsf = ies->tsf;
@@ -4829,7 +4826,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
4829 rcu_read_unlock(); 4826 rcu_read_unlock();
4830 4827
4831 if (WARN((sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD) && 4828 if (WARN((sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD) &&
4832 (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK), 4829 ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK),
4833 "U-APSD not supported with HW_PS_NULLFUNC_STACK\n")) 4830 "U-APSD not supported with HW_PS_NULLFUNC_STACK\n"))
4834 sdata->vif.driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; 4831 sdata->vif.driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD;
4835 4832
@@ -4910,7 +4907,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
4910 rcu_read_lock(); 4907 rcu_read_lock();
4911 beacon_ies = rcu_dereference(req->bss->beacon_ies); 4908 beacon_ies = rcu_dereference(req->bss->beacon_ies);
4912 4909
4913 if (sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC && 4910 if (ieee80211_hw_check(&sdata->local->hw, NEED_DTIM_BEFORE_ASSOC) &&
4914 !beacon_ies) { 4911 !beacon_ies) {
4915 /* 4912 /*
4916 * Wait up to one beacon interval ... 4913 * Wait up to one beacon interval ...
@@ -4937,7 +4934,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
4937 assoc_data->timeout = jiffies; 4934 assoc_data->timeout = jiffies;
4938 assoc_data->timeout_started = true; 4935 assoc_data->timeout_started = true;
4939 4936
4940 if (local->hw.flags & IEEE80211_HW_TIMING_BEACON_ONLY) { 4937 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY)) {
4941 sdata->vif.bss_conf.sync_tsf = beacon_ies->tsf; 4938 sdata->vif.bss_conf.sync_tsf = beacon_ies->tsf;
4942 sdata->vif.bss_conf.sync_device_ts = 4939 sdata->vif.bss_conf.sync_device_ts =
4943 bss->device_ts_beacon; 4940 bss->device_ts_beacon;
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index 683f0e3cb124..f2c75cf491fc 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -46,7 +46,7 @@ static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata)
46 } 46 }
47 47
48 if (!local->offchannel_ps_enabled || 48 if (!local->offchannel_ps_enabled ||
49 !(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)) 49 !ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK))
50 /* 50 /*
51 * If power save was enabled, no need to send a nullfunc 51 * If power save was enabled, no need to send a nullfunc
52 * frame because AP knows that we are sleeping. But if the 52 * frame because AP knows that we are sleeping. But if the
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index ac6ad6238e3a..06b60980c62c 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -23,7 +23,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
23 23
24 ieee80211_del_virtual_monitor(local); 24 ieee80211_del_virtual_monitor(local);
25 25
26 if (hw->flags & IEEE80211_HW_AMPDU_AGGREGATION) { 26 if (ieee80211_hw_check(hw, AMPDU_AGGREGATION)) {
27 mutex_lock(&local->sta_mtx); 27 mutex_lock(&local->sta_mtx);
28 list_for_each_entry(sta, &local->sta_list, list) { 28 list_for_each_entry(sta, &local->sta_list, list) {
29 set_sta_flag(sta, WLAN_STA_BLOCK_BA); 29 set_sta_flag(sta, WLAN_STA_BLOCK_BA);
@@ -82,7 +82,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
82 if (err < 0) { 82 if (err < 0) {
83 local->quiescing = false; 83 local->quiescing = false;
84 local->wowlan = false; 84 local->wowlan = false;
85 if (hw->flags & IEEE80211_HW_AMPDU_AGGREGATION) { 85 if (ieee80211_hw_check(hw, AMPDU_AGGREGATION)) {
86 mutex_lock(&local->sta_mtx); 86 mutex_lock(&local->sta_mtx);
87 list_for_each_entry(sta, 87 list_for_each_entry(sta,
88 &local->sta_list, list) { 88 &local->sta_list, list) {
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index de69adf24f53..36ba7c4f0283 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -680,7 +680,7 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
680 info->control.rates[i].count = 0; 680 info->control.rates[i].count = 0;
681 } 681 }
682 682
683 if (sdata->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) 683 if (ieee80211_hw_check(&sdata->local->hw, HAS_RATE_CONTROL))
684 return; 684 return;
685 685
686 if (ista) { 686 if (ista) {
@@ -691,7 +691,7 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
691 ref->ops->get_rate(ref->priv, NULL, NULL, txrc); 691 ref->ops->get_rate(ref->priv, NULL, NULL, txrc);
692 } 692 }
693 693
694 if (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_RC_TABLE) 694 if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_RC_TABLE))
695 return; 695 return;
696 696
697 ieee80211_get_tx_rates(&sdata->vif, ista, txrc->skb, 697 ieee80211_get_tx_rates(&sdata->vif, ista, txrc->skb,
@@ -733,7 +733,7 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
733 if (local->open_count) 733 if (local->open_count)
734 return -EBUSY; 734 return -EBUSY;
735 735
736 if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) { 736 if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) {
737 if (WARN_ON(!local->ops->set_rts_threshold)) 737 if (WARN_ON(!local->ops->set_rts_threshold))
738 return -EINVAL; 738 return -EINVAL;
739 return 0; 739 return 0;
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index 7430a1df2ab1..543b67233535 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -1070,7 +1070,7 @@ minstrel_ht_update_cck(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
1070 if (sband->band != IEEE80211_BAND_2GHZ) 1070 if (sband->band != IEEE80211_BAND_2GHZ)
1071 return; 1071 return;
1072 1072
1073 if (!(mp->hw->flags & IEEE80211_HW_SUPPORTS_HT_CCK_RATES)) 1073 if (!ieee80211_hw_check(mp->hw, SUPPORTS_HT_CCK_RATES))
1074 return; 1074 return;
1075 1075
1076 mi->cck_supported = 0; 1076 mi->cck_supported = 0;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 7d85f7516324..5dae166cb7f5 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -52,7 +52,7 @@ static struct sk_buff *remove_monitor_info(struct ieee80211_local *local,
52 struct sk_buff *skb, 52 struct sk_buff *skb,
53 unsigned int rtap_vendor_space) 53 unsigned int rtap_vendor_space)
54{ 54{
55 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) { 55 if (ieee80211_hw_check(&local->hw, RX_INCLUDES_FCS)) {
56 if (likely(skb->len > FCS_LEN)) 56 if (likely(skb->len > FCS_LEN))
57 __pskb_trim(skb, skb->len - FCS_LEN); 57 __pskb_trim(skb, skb->len - FCS_LEN);
58 else { 58 else {
@@ -110,7 +110,7 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local,
110 len = ALIGN(len, 8); 110 len = ALIGN(len, 8);
111 len += 8; 111 len += 8;
112 } 112 }
113 if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) 113 if (ieee80211_hw_check(&local->hw, SIGNAL_DBM))
114 len += 1; 114 len += 1;
115 115
116 /* antenna field, if we don't have per-chain info */ 116 /* antenna field, if we don't have per-chain info */
@@ -185,7 +185,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
185 } 185 }
186 186
187 mpdulen = skb->len; 187 mpdulen = skb->len;
188 if (!(has_fcs && (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS))) 188 if (!(has_fcs && ieee80211_hw_check(&local->hw, RX_INCLUDES_FCS)))
189 mpdulen += FCS_LEN; 189 mpdulen += FCS_LEN;
190 190
191 rthdr = (struct ieee80211_radiotap_header *)skb_push(skb, rtap_len); 191 rthdr = (struct ieee80211_radiotap_header *)skb_push(skb, rtap_len);
@@ -239,7 +239,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
239 } 239 }
240 240
241 /* IEEE80211_RADIOTAP_FLAGS */ 241 /* IEEE80211_RADIOTAP_FLAGS */
242 if (has_fcs && (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)) 242 if (has_fcs && ieee80211_hw_check(&local->hw, RX_INCLUDES_FCS))
243 *pos |= IEEE80211_RADIOTAP_F_FCS; 243 *pos |= IEEE80211_RADIOTAP_F_FCS;
244 if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) 244 if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC))
245 *pos |= IEEE80211_RADIOTAP_F_BADFCS; 245 *pos |= IEEE80211_RADIOTAP_F_BADFCS;
@@ -289,7 +289,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
289 pos += 2; 289 pos += 2;
290 290
291 /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */ 291 /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
292 if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM && 292 if (ieee80211_hw_check(&local->hw, SIGNAL_DBM) &&
293 !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) { 293 !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
294 *pos = status->signal; 294 *pos = status->signal;
295 rthdr->it_present |= 295 rthdr->it_present |=
@@ -458,7 +458,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
458 * the SKB because it has a bad FCS/PLCP checksum. 458 * the SKB because it has a bad FCS/PLCP checksum.
459 */ 459 */
460 460
461 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) 461 if (ieee80211_hw_check(&local->hw, RX_INCLUDES_FCS))
462 present_fcs_len = FCS_LEN; 462 present_fcs_len = FCS_LEN;
463 463
464 /* ensure hdr->frame_control and vendor radiotap data are in skb head */ 464 /* ensure hdr->frame_control and vendor radiotap data are in skb head */
@@ -1197,7 +1197,7 @@ static void sta_ps_start(struct sta_info *sta)
1197 1197
1198 atomic_inc(&ps->num_sta_ps); 1198 atomic_inc(&ps->num_sta_ps);
1199 set_sta_flag(sta, WLAN_STA_PS_STA); 1199 set_sta_flag(sta, WLAN_STA_PS_STA);
1200 if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS)) 1200 if (!ieee80211_hw_check(&local->hw, AP_LINK_PS))
1201 drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta); 1201 drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta);
1202 ps_dbg(sdata, "STA %pM aid %d enters power save mode\n", 1202 ps_dbg(sdata, "STA %pM aid %d enters power save mode\n",
1203 sta->sta.addr, sta->sta.aid); 1203 sta->sta.addr, sta->sta.aid);
@@ -1245,7 +1245,7 @@ int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start)
1245 struct sta_info *sta_inf = container_of(sta, struct sta_info, sta); 1245 struct sta_info *sta_inf = container_of(sta, struct sta_info, sta);
1246 bool in_ps; 1246 bool in_ps;
1247 1247
1248 WARN_ON(!(sta_inf->local->hw.flags & IEEE80211_HW_AP_LINK_PS)); 1248 WARN_ON(!ieee80211_hw_check(&sta_inf->local->hw, AP_LINK_PS));
1249 1249
1250 /* Don't let the same PS state be set twice */ 1250 /* Don't let the same PS state be set twice */
1251 in_ps = test_sta_flag(sta_inf, WLAN_STA_PS_STA); 1251 in_ps = test_sta_flag(sta_inf, WLAN_STA_PS_STA);
@@ -1281,7 +1281,7 @@ ieee80211_rx_h_uapsd_and_pspoll(struct ieee80211_rx_data *rx)
1281 * uAPSD and PS-Poll frames (the latter shouldn't even come up from 1281 * uAPSD and PS-Poll frames (the latter shouldn't even come up from
1282 * it to mac80211 since they're handled.) 1282 * it to mac80211 since they're handled.)
1283 */ 1283 */
1284 if (sdata->local->hw.flags & IEEE80211_HW_AP_LINK_PS) 1284 if (ieee80211_hw_check(&sdata->local->hw, AP_LINK_PS))
1285 return RX_CONTINUE; 1285 return RX_CONTINUE;
1286 1286
1287 /* 1287 /*
@@ -1413,7 +1413,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
1413 * Change STA power saving mode only at the end of a frame 1413 * Change STA power saving mode only at the end of a frame
1414 * exchange sequence. 1414 * exchange sequence.
1415 */ 1415 */
1416 if (!(sta->local->hw.flags & IEEE80211_HW_AP_LINK_PS) && 1416 if (!ieee80211_hw_check(&sta->local->hw, AP_LINK_PS) &&
1417 !ieee80211_has_morefrags(hdr->frame_control) && 1417 !ieee80211_has_morefrags(hdr->frame_control) &&
1418 !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) && 1418 !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) &&
1419 (rx->sdata->vif.type == NL80211_IFTYPE_AP || 1419 (rx->sdata->vif.type == NL80211_IFTYPE_AP ||
@@ -2543,7 +2543,7 @@ ieee80211_rx_h_mgmt_check(struct ieee80211_rx_data *rx)
2543 !(rx->flags & IEEE80211_RX_BEACON_REPORTED)) { 2543 !(rx->flags & IEEE80211_RX_BEACON_REPORTED)) {
2544 int sig = 0; 2544 int sig = 0;
2545 2545
2546 if (rx->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) 2546 if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM))
2547 sig = status->signal; 2547 sig = status->signal;
2548 2548
2549 cfg80211_report_obss_beacon(rx->local->hw.wiphy, 2549 cfg80211_report_obss_beacon(rx->local->hw.wiphy,
@@ -2874,7 +2874,7 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
2874 * it transmitted were processed or returned. 2874 * it transmitted were processed or returned.
2875 */ 2875 */
2876 2876
2877 if (rx->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) 2877 if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM))
2878 sig = status->signal; 2878 sig = status->signal;
2879 2879
2880 if (cfg80211_rx_mgmt(&rx->sdata->wdev, status->freq, sig, 2880 if (cfg80211_rx_mgmt(&rx->sdata->wdev, status->freq, sig,
@@ -2939,7 +2939,7 @@ ieee80211_rx_h_action_return(struct ieee80211_rx_data *rx)
2939 info->flags = IEEE80211_TX_CTL_TX_OFFCHAN | 2939 info->flags = IEEE80211_TX_CTL_TX_OFFCHAN |
2940 IEEE80211_TX_INTFL_OFFCHAN_TX_OK | 2940 IEEE80211_TX_INTFL_OFFCHAN_TX_OK |
2941 IEEE80211_TX_CTL_NO_CCK_RATE; 2941 IEEE80211_TX_CTL_NO_CCK_RATE;
2942 if (local->hw.flags & IEEE80211_HW_QUEUE_CONTROL) 2942 if (ieee80211_hw_check(&local->hw, QUEUE_CONTROL))
2943 info->hw_queue = 2943 info->hw_queue =
2944 local->hw.offchannel_tx_hw_queue; 2944 local->hw.offchannel_tx_hw_queue;
2945 } 2945 }
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 1454c1b7d06c..11d0901ebb7b 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -71,9 +71,9 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
71 s32 signal = 0; 71 s32 signal = 0;
72 bool signal_valid; 72 bool signal_valid;
73 73
74 if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) 74 if (ieee80211_hw_check(&local->hw, SIGNAL_DBM))
75 signal = rx_status->signal * 100; 75 signal = rx_status->signal * 100;
76 else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) 76 else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC))
77 signal = (rx_status->signal * 100) / local->hw.max_signal; 77 signal = (rx_status->signal * 100) / local->hw.max_signal;
78 78
79 scan_width = NL80211_BSS_CHAN_WIDTH_20; 79 scan_width = NL80211_BSS_CHAN_WIDTH_20;
@@ -263,7 +263,7 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local)
263 if (test_bit(SCAN_HW_CANCELLED, &local->scanning)) 263 if (test_bit(SCAN_HW_CANCELLED, &local->scanning))
264 return false; 264 return false;
265 265
266 if (local->hw.flags & IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS) { 266 if (ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS)) {
267 for (i = 0; i < req->n_channels; i++) { 267 for (i = 0; i < req->n_channels; i++) {
268 local->hw_scan_req->req.channels[i] = req->channels[i]; 268 local->hw_scan_req->req.channels[i] = req->channels[i];
269 bands_used |= BIT(req->channels[i]->band); 269 bands_used |= BIT(req->channels[i]->band);
@@ -332,7 +332,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
332 return; 332 return;
333 333
334 if (hw_scan && !aborted && 334 if (hw_scan && !aborted &&
335 !(local->hw.flags & IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS) && 335 !ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS) &&
336 ieee80211_prep_hw_scan(local)) { 336 ieee80211_prep_hw_scan(local)) {
337 int rc; 337 int rc;
338 338
@@ -526,7 +526,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
526 526
527 local->hw_scan_ies_bufsize = local->scan_ies_len + req->ie_len; 527 local->hw_scan_ies_bufsize = local->scan_ies_len + req->ie_len;
528 528
529 if (local->hw.flags & IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS) { 529 if (ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS)) {
530 int i, n_bands = 0; 530 int i, n_bands = 0;
531 u8 bands_counted = 0; 531 u8 bands_counted = 0;
532 532
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index ce0c1662de42..666ddac3c87c 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -282,7 +282,7 @@ static void sta_deliver_ps_frames(struct work_struct *wk)
282static int sta_prepare_rate_control(struct ieee80211_local *local, 282static int sta_prepare_rate_control(struct ieee80211_local *local,
283 struct sta_info *sta, gfp_t gfp) 283 struct sta_info *sta, gfp_t gfp)
284{ 284{
285 if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) 285 if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL))
286 return 0; 286 return 0;
287 287
288 sta->rate_ctrl = local->rate_ctrl; 288 sta->rate_ctrl = local->rate_ctrl;
@@ -643,7 +643,7 @@ static void __sta_info_recalc_tim(struct sta_info *sta, bool ignore_pending)
643 } 643 }
644 644
645 /* No need to do anything if the driver does all */ 645 /* No need to do anything if the driver does all */
646 if (local->hw.flags & IEEE80211_HW_AP_LINK_PS) 646 if (ieee80211_hw_check(&local->hw, AP_LINK_PS))
647 return; 647 return;
648 648
649 if (sta->dead) 649 if (sta->dead)
@@ -1148,7 +1148,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
1148 sta->driver_buffered_tids = 0; 1148 sta->driver_buffered_tids = 0;
1149 sta->txq_buffered_tids = 0; 1149 sta->txq_buffered_tids = 0;
1150 1150
1151 if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS)) 1151 if (!ieee80211_hw_check(&local->hw, AP_LINK_PS))
1152 drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta); 1152 drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta);
1153 1153
1154 if (sta->sta.txq[0]) { 1154 if (sta->sta.txq[0]) {
@@ -1879,8 +1879,8 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1879 sinfo->rx_beacon_signal_avg = ieee80211_ave_rssi(&sdata->vif); 1879 sinfo->rx_beacon_signal_avg = ieee80211_ave_rssi(&sdata->vif);
1880 } 1880 }
1881 1881
1882 if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || 1882 if (ieee80211_hw_check(&sta->local->hw, SIGNAL_DBM) ||
1883 (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { 1883 ieee80211_hw_check(&sta->local->hw, SIGNAL_UNSPEC)) {
1884 if (!(sinfo->filled & BIT(NL80211_STA_INFO_SIGNAL))) { 1884 if (!(sinfo->filled & BIT(NL80211_STA_INFO_SIGNAL))) {
1885 sinfo->signal = (s8)sta->last_signal; 1885 sinfo->signal = (s8)sta->last_signal;
1886 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); 1886 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
@@ -1932,7 +1932,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1932 1932
1933 if (!(tidstats->filled & 1933 if (!(tidstats->filled &
1934 BIT(NL80211_TID_STATS_TX_MSDU_RETRIES)) && 1934 BIT(NL80211_TID_STATS_TX_MSDU_RETRIES)) &&
1935 local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { 1935 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
1936 tidstats->filled |= 1936 tidstats->filled |=
1937 BIT(NL80211_TID_STATS_TX_MSDU_RETRIES); 1937 BIT(NL80211_TID_STATS_TX_MSDU_RETRIES);
1938 tidstats->tx_msdu_retries = sta->tx_msdu_retries[i]; 1938 tidstats->tx_msdu_retries = sta->tx_msdu_retries[i];
@@ -1940,7 +1940,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1940 1940
1941 if (!(tidstats->filled & 1941 if (!(tidstats->filled &
1942 BIT(NL80211_TID_STATS_TX_MSDU_FAILED)) && 1942 BIT(NL80211_TID_STATS_TX_MSDU_FAILED)) &&
1943 local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { 1943 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
1944 tidstats->filled |= 1944 tidstats->filled |=
1945 BIT(NL80211_TID_STATS_TX_MSDU_FAILED); 1945 BIT(NL80211_TID_STATS_TX_MSDU_FAILED);
1946 tidstats->tx_msdu_failed = sta->tx_msdu_failed[i]; 1946 tidstats->tx_msdu_failed = sta->tx_msdu_failed[i];
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 67c428735a51..45628f37c083 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -181,7 +181,7 @@ static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb)
181 struct ieee80211_local *local = sta->local; 181 struct ieee80211_local *local = sta->local;
182 struct ieee80211_sub_if_data *sdata = sta->sdata; 182 struct ieee80211_sub_if_data *sdata = sta->sdata;
183 183
184 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 184 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
185 sta->last_rx = jiffies; 185 sta->last_rx = jiffies;
186 186
187 if (ieee80211_is_data_qos(mgmt->frame_control)) { 187 if (ieee80211_is_data_qos(mgmt->frame_control)) {
@@ -414,8 +414,7 @@ static void ieee80211_tdls_td_tx_handle(struct ieee80211_local *local,
414 414
415 if (is_teardown) { 415 if (is_teardown) {
416 /* This mechanism relies on being able to get ACKs */ 416 /* This mechanism relies on being able to get ACKs */
417 WARN_ON(!(local->hw.flags & 417 WARN_ON(!ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS));
418 IEEE80211_HW_REPORTS_TX_ACK_STATUS));
419 418
420 /* Check if peer has ACKed */ 419 /* Check if peer has ACKed */
421 if (flags & IEEE80211_TX_STAT_ACK) { 420 if (flags & IEEE80211_TX_STAT_ACK) {
@@ -731,7 +730,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
731 ieee80211_get_qos_ctl(hdr), 730 ieee80211_get_qos_ctl(hdr),
732 sta, true, acked); 731 sta, true, acked);
733 732
734 if ((local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) && 733 if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL) &&
735 (ieee80211_is_data(hdr->frame_control)) && 734 (ieee80211_is_data(hdr->frame_control)) &&
736 (rates_idx != -1)) 735 (rates_idx != -1))
737 sta->last_tx_rate = info->status.rates[rates_idx]; 736 sta->last_tx_rate = info->status.rates[rates_idx];
@@ -798,11 +797,11 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
798 ieee80211_frame_acked(sta, skb); 797 ieee80211_frame_acked(sta, skb);
799 798
800 if ((sta->sdata->vif.type == NL80211_IFTYPE_STATION) && 799 if ((sta->sdata->vif.type == NL80211_IFTYPE_STATION) &&
801 (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)) 800 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
802 ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data, 801 ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data,
803 acked, info->status.tx_time); 802 acked, info->status.tx_time);
804 803
805 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { 804 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
806 if (info->flags & IEEE80211_TX_STAT_ACK) { 805 if (info->flags & IEEE80211_TX_STAT_ACK) {
807 if (sta->lost_packets) 806 if (sta->lost_packets)
808 sta->lost_packets = 0; 807 sta->lost_packets = 0;
@@ -853,7 +852,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
853 } 852 }
854 853
855 if (ieee80211_is_nullfunc(fc) && ieee80211_has_pm(fc) && 854 if (ieee80211_is_nullfunc(fc) && ieee80211_has_pm(fc) &&
856 (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) && 855 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS) &&
857 !(info->flags & IEEE80211_TX_CTL_INJECTED) && 856 !(info->flags & IEEE80211_TX_CTL_INJECTED) &&
858 local->ps_sdata && !(local->scanning)) { 857 local->ps_sdata && !(local->scanning)) {
859 if (info->flags & IEEE80211_TX_STAT_ACK) { 858 if (info->flags & IEEE80211_TX_STAT_ACK) {
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index 28298cc50326..ad31b2dab4f5 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -935,7 +935,7 @@ ieee80211_tdls_prep_mgmt_packet(struct wiphy *wiphy, struct net_device *dev,
935 * packet through the AP. 935 * packet through the AP.
936 */ 936 */
937 if ((action_code == WLAN_TDLS_TEARDOWN) && 937 if ((action_code == WLAN_TDLS_TEARDOWN) &&
938 (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)) { 938 ieee80211_hw_check(&sdata->local->hw, REPORTS_TX_ACK_STATUS)) {
939 bool try_resend; /* Should we keep skb for possible resend */ 939 bool try_resend; /* Should we keep skb for possible resend */
940 940
941 /* If not sending directly to peer - no point in keeping skb */ 941 /* If not sending directly to peer - no point in keeping skb */
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 7fe528adc5ae..8410bb3bf5e8 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -211,11 +211,11 @@ ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
211 struct ieee80211_if_managed *ifmgd; 211 struct ieee80211_if_managed *ifmgd;
212 212
213 /* driver doesn't support power save */ 213 /* driver doesn't support power save */
214 if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) 214 if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS))
215 return TX_CONTINUE; 215 return TX_CONTINUE;
216 216
217 /* hardware does dynamic power save */ 217 /* hardware does dynamic power save */
218 if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) 218 if (ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS))
219 return TX_CONTINUE; 219 return TX_CONTINUE;
220 220
221 /* dynamic power save disabled */ 221 /* dynamic power save disabled */
@@ -431,7 +431,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
431 if (ieee80211_is_probe_req(hdr->frame_control)) 431 if (ieee80211_is_probe_req(hdr->frame_control))
432 return TX_CONTINUE; 432 return TX_CONTINUE;
433 433
434 if (tx->local->hw.flags & IEEE80211_HW_QUEUE_CONTROL) 434 if (ieee80211_hw_check(&tx->local->hw, QUEUE_CONTROL))
435 info->hw_queue = tx->sdata->vif.cab_queue; 435 info->hw_queue = tx->sdata->vif.cab_queue;
436 436
437 /* no stations in PS mode */ 437 /* no stations in PS mode */
@@ -441,7 +441,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
441 info->flags |= IEEE80211_TX_CTL_SEND_AFTER_DTIM; 441 info->flags |= IEEE80211_TX_CTL_SEND_AFTER_DTIM;
442 442
443 /* device releases frame after DTIM beacon */ 443 /* device releases frame after DTIM beacon */
444 if (!(tx->local->hw.flags & IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING)) 444 if (!ieee80211_hw_check(&tx->local->hw, HOST_BROADCAST_PS_BUFFERING))
445 return TX_CONTINUE; 445 return TX_CONTINUE;
446 446
447 /* buffered in mac80211 */ 447 /* buffered in mac80211 */
@@ -1185,8 +1185,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
1185 1185
1186 if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) && 1186 if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
1187 !ieee80211_is_qos_nullfunc(hdr->frame_control) && 1187 !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
1188 (local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION) && 1188 ieee80211_hw_check(&local->hw, AMPDU_AGGREGATION) &&
1189 !(local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW)) { 1189 !ieee80211_hw_check(&local->hw, TX_AMPDU_SETUP_IN_HW)) {
1190 struct tid_ampdu_tx *tid_tx; 1190 struct tid_ampdu_tx *tid_tx;
1191 1191
1192 qc = ieee80211_get_qos_ctl(hdr); 1192 qc = ieee80211_get_qos_ctl(hdr);
@@ -1429,7 +1429,7 @@ static bool __ieee80211_tx(struct ieee80211_local *local,
1429 vif = &sdata->vif; 1429 vif = &sdata->vif;
1430 info->hw_queue = 1430 info->hw_queue =
1431 vif->hw_queue[skb_get_queue_mapping(skb)]; 1431 vif->hw_queue[skb_get_queue_mapping(skb)];
1432 } else if (local->hw.flags & IEEE80211_HW_QUEUE_CONTROL) { 1432 } else if (ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) {
1433 dev_kfree_skb(skb); 1433 dev_kfree_skb(skb);
1434 return true; 1434 return true;
1435 } else 1435 } else
@@ -1475,7 +1475,7 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx)
1475 CALL_TXH(ieee80211_tx_h_ps_buf); 1475 CALL_TXH(ieee80211_tx_h_ps_buf);
1476 CALL_TXH(ieee80211_tx_h_check_control_port_protocol); 1476 CALL_TXH(ieee80211_tx_h_check_control_port_protocol);
1477 CALL_TXH(ieee80211_tx_h_select_key); 1477 CALL_TXH(ieee80211_tx_h_select_key);
1478 if (!(tx->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)) 1478 if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
1479 CALL_TXH(ieee80211_tx_h_rate_ctrl); 1479 CALL_TXH(ieee80211_tx_h_rate_ctrl);
1480 1480
1481 if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) { 1481 if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) {
@@ -1490,7 +1490,7 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx)
1490 /* handlers after fragment must be aware of tx info fragmentation! */ 1490 /* handlers after fragment must be aware of tx info fragmentation! */
1491 CALL_TXH(ieee80211_tx_h_stats); 1491 CALL_TXH(ieee80211_tx_h_stats);
1492 CALL_TXH(ieee80211_tx_h_encrypt); 1492 CALL_TXH(ieee80211_tx_h_encrypt);
1493 if (!(tx->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)) 1493 if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
1494 CALL_TXH(ieee80211_tx_h_calculate_duration); 1494 CALL_TXH(ieee80211_tx_h_calculate_duration);
1495#undef CALL_TXH 1495#undef CALL_TXH
1496 1496
@@ -1580,7 +1580,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
1580 1580
1581 /* set up hw_queue value early */ 1581 /* set up hw_queue value early */
1582 if (!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) || 1582 if (!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) ||
1583 !(local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)) 1583 !ieee80211_hw_check(&local->hw, QUEUE_CONTROL))
1584 info->hw_queue = 1584 info->hw_queue =
1585 sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; 1585 sdata->vif.hw_queue[skb_get_queue_mapping(skb)];
1586 1586
@@ -1607,7 +1607,7 @@ static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata,
1607 } 1607 }
1608 1608
1609 if (skb_cloned(skb) && 1609 if (skb_cloned(skb) &&
1610 (!(local->hw.flags & IEEE80211_HW_SUPPORTS_CLONED_SKBS) || 1610 (!ieee80211_hw_check(&local->hw, SUPPORTS_CLONED_SKBS) ||
1611 !skb_clone_writable(skb, ETH_HLEN) || 1611 !skb_clone_writable(skb, ETH_HLEN) ||
1612 (may_encrypt && sdata->crypto_tx_tailroom_needed_cnt))) 1612 (may_encrypt && sdata->crypto_tx_tailroom_needed_cnt)))
1613 I802_DEBUG_INC(local->tx_expand_skb_head_cloned); 1613 I802_DEBUG_INC(local->tx_expand_skb_head_cloned);
@@ -2426,7 +2426,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta)
2426 struct ieee80211_chanctx_conf *chanctx_conf; 2426 struct ieee80211_chanctx_conf *chanctx_conf;
2427 __le16 fc; 2427 __le16 fc;
2428 2428
2429 if (!(local->hw.flags & IEEE80211_HW_SUPPORT_FAST_XMIT)) 2429 if (!ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT))
2430 return; 2430 return;
2431 2431
2432 /* Locking here protects both the pointer itself, and against concurrent 2432 /* Locking here protects both the pointer itself, and against concurrent
@@ -2442,8 +2442,8 @@ void ieee80211_check_fast_xmit(struct sta_info *sta)
2442 * cleared/changed already. 2442 * cleared/changed already.
2443 */ 2443 */
2444 spin_lock_bh(&sta->lock); 2444 spin_lock_bh(&sta->lock);
2445 if (local->hw.flags & IEEE80211_HW_SUPPORTS_PS && 2445 if (ieee80211_hw_check(&local->hw, SUPPORTS_PS) &&
2446 !(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) && 2446 !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS) &&
2447 sdata->vif.type == NL80211_IFTYPE_STATION) 2447 sdata->vif.type == NL80211_IFTYPE_STATION)
2448 goto out; 2448 goto out;
2449 2449
@@ -2790,7 +2790,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
2790 if (fast_tx->key) 2790 if (fast_tx->key)
2791 info->control.hw_key = &fast_tx->key->conf; 2791 info->control.hw_key = &fast_tx->key->conf;
2792 2792
2793 if (!(local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)) { 2793 if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) {
2794 tx.skb = skb; 2794 tx.skb = skb;
2795 r = ieee80211_tx_h_rate_ctrl(&tx); 2795 r = ieee80211_tx_h_rate_ctrl(&tx);
2796 skb = tx.skb; 2796 skb = tx.skb;
@@ -3807,7 +3807,7 @@ int ieee80211_reserve_tid(struct ieee80211_sta *pubsta, u8 tid)
3807 synchronize_net(); 3807 synchronize_net();
3808 3808
3809 /* Tear down BA sessions so we stop aggregating on this TID */ 3809 /* Tear down BA sessions so we stop aggregating on this TID */
3810 if (local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION) { 3810 if (ieee80211_hw_check(&local->hw, AMPDU_AGGREGATION)) {
3811 set_sta_flag(sta, WLAN_STA_BLOCK_BA); 3811 set_sta_flag(sta, WLAN_STA_BLOCK_BA);
3812 __ieee80211_stop_tx_ba_session(sta, tid, 3812 __ieee80211_stop_tx_ba_session(sta, tid,
3813 AGG_STOP_LOCAL_REQUEST); 3813 AGG_STOP_LOCAL_REQUEST);
@@ -3821,7 +3821,7 @@ int ieee80211_reserve_tid(struct ieee80211_sta *pubsta, u8 tid)
3821 ieee80211_wake_vif_queues(local, sdata, 3821 ieee80211_wake_vif_queues(local, sdata,
3822 IEEE80211_QUEUE_STOP_REASON_RESERVE_TID); 3822 IEEE80211_QUEUE_STOP_REASON_RESERVE_TID);
3823 3823
3824 if (local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION) 3824 if (ieee80211_hw_check(&local->hw, AMPDU_AGGREGATION))
3825 clear_sta_flag(sta, WLAN_STA_BLOCK_BA); 3825 clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
3826 3826
3827 ret = 0; 3827 ret = 0;
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index b864ebc6ab8f..43e5aadd7a89 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -564,7 +564,7 @@ ieee80211_get_vif_queues(struct ieee80211_local *local,
564{ 564{
565 unsigned int queues; 565 unsigned int queues;
566 566
567 if (sdata && local->hw.flags & IEEE80211_HW_QUEUE_CONTROL) { 567 if (sdata && ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) {
568 int ac; 568 int ac;
569 569
570 queues = 0; 570 queues = 0;
@@ -592,7 +592,7 @@ void __ieee80211_flush_queues(struct ieee80211_local *local,
592 * If no queue was set, or if the HW doesn't support 592 * If no queue was set, or if the HW doesn't support
593 * IEEE80211_HW_QUEUE_CONTROL - flush all queues 593 * IEEE80211_HW_QUEUE_CONTROL - flush all queues
594 */ 594 */
595 if (!queues || !(local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)) 595 if (!queues || !ieee80211_hw_check(&local->hw, QUEUE_CONTROL))
596 queues = ieee80211_get_vif_queues(local, sdata); 596 queues = ieee80211_get_vif_queues(local, sdata);
597 597
598 ieee80211_stop_queues_by_reason(&local->hw, queues, 598 ieee80211_stop_queues_by_reason(&local->hw, queues,
@@ -2046,7 +2046,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
2046 * about the sessions, but we and the AP still think they 2046 * about the sessions, but we and the AP still think they
2047 * are active. This is really a workaround though. 2047 * are active. This is really a workaround though.
2048 */ 2048 */
2049 if (hw->flags & IEEE80211_HW_AMPDU_AGGREGATION) { 2049 if (ieee80211_hw_check(hw, AMPDU_AGGREGATION)) {
2050 mutex_lock(&local->sta_mtx); 2050 mutex_lock(&local->sta_mtx);
2051 2051
2052 list_for_each_entry(sta, &local->sta_list, list) { 2052 list_for_each_entry(sta, &local->sta_list, list) {