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>
This commit is contained in:
Johannes Berg 2015-06-02 21:39:54 +02:00
commit 30686bf7f5
59 changed files with 447 additions and 423 deletions

View file

@ -1887,37 +1887,42 @@ struct ieee80211_txq {
*
* @IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS: The HW supports scanning on all bands
* in one command, mac80211 doesn't have to run separate scans per band.
*
* @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
*/
enum ieee80211_hw_flags {
IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2,
IEEE80211_HW_SIGNAL_UNSPEC = 1<<5,
IEEE80211_HW_SIGNAL_DBM = 1<<6,
IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC = 1<<7,
IEEE80211_HW_SPECTRUM_MGMT = 1<<8,
IEEE80211_HW_AMPDU_AGGREGATION = 1<<9,
IEEE80211_HW_SUPPORTS_PS = 1<<10,
IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11,
IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
IEEE80211_HW_MFP_CAPABLE = 1<<13,
IEEE80211_HW_WANT_MONITOR_VIF = 1<<14,
IEEE80211_HW_NO_AUTO_VIF = 1<<15,
IEEE80211_HW_SW_CRYPTO_CONTROL = 1<<16,
IEEE80211_HW_SUPPORT_FAST_XMIT = 1<<17,
IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
IEEE80211_HW_QUEUE_CONTROL = 1<<20,
IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
IEEE80211_HW_AP_LINK_PS = 1<<22,
IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
IEEE80211_HW_SUPPORTS_RC_TABLE = 1<<24,
IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25,
IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26,
IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27,
IEEE80211_HW_CHANCTX_STA_CSA = 1<<28,
IEEE80211_HW_SUPPORTS_CLONED_SKBS = 1<<29,
IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS = 1<<30,
IEEE80211_HW_HAS_RATE_CONTROL,
IEEE80211_HW_RX_INCLUDES_FCS,
IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING,
IEEE80211_HW_SIGNAL_UNSPEC,
IEEE80211_HW_SIGNAL_DBM,
IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC,
IEEE80211_HW_SPECTRUM_MGMT,
IEEE80211_HW_AMPDU_AGGREGATION,
IEEE80211_HW_SUPPORTS_PS,
IEEE80211_HW_PS_NULLFUNC_STACK,
IEEE80211_HW_SUPPORTS_DYNAMIC_PS,
IEEE80211_HW_MFP_CAPABLE,
IEEE80211_HW_WANT_MONITOR_VIF,
IEEE80211_HW_NO_AUTO_VIF,
IEEE80211_HW_SW_CRYPTO_CONTROL,
IEEE80211_HW_SUPPORT_FAST_XMIT,
IEEE80211_HW_REPORTS_TX_ACK_STATUS,
IEEE80211_HW_CONNECTION_MONITOR,
IEEE80211_HW_QUEUE_CONTROL,
IEEE80211_HW_SUPPORTS_PER_STA_GTK,
IEEE80211_HW_AP_LINK_PS,
IEEE80211_HW_TX_AMPDU_SETUP_IN_HW,
IEEE80211_HW_SUPPORTS_RC_TABLE,
IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF,
IEEE80211_HW_TIMING_BEACON_ONLY,
IEEE80211_HW_SUPPORTS_HT_CCK_RATES,
IEEE80211_HW_CHANCTX_STA_CSA,
IEEE80211_HW_SUPPORTS_CLONED_SKBS,
IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS,
/* keep last, obviously */
NUM_IEEE80211_HW_FLAGS
};
/**
@ -2024,7 +2029,7 @@ struct ieee80211_hw {
struct wiphy *wiphy;
const char *rate_control_algorithm;
void *priv;
u32 flags;
unsigned long flags[BITS_TO_LONGS(NUM_IEEE80211_HW_FLAGS)];
unsigned int extra_tx_headroom;
unsigned int extra_beacon_tailroom;
int vif_data_size;
@ -2050,6 +2055,20 @@ struct ieee80211_hw {
int txq_ac_max_pending;
};
static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,
enum ieee80211_hw_flags flg)
{
return test_bit(flg, hw->flags);
}
#define ieee80211_hw_check(hw, flg) _ieee80211_hw_check(hw, IEEE80211_HW_##flg)
static inline void _ieee80211_hw_set(struct ieee80211_hw *hw,
enum ieee80211_hw_flags flg)
{
return __set_bit(flg, hw->flags);
}
#define ieee80211_hw_set(hw, flg) _ieee80211_hw_set(hw, IEEE80211_HW_##flg)
/**
* struct ieee80211_scan_request - hw scan request
*