Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[firefly-linux-kernel-4.4.55.git] / include / net / mac80211.h
index fc57f6b82fc59e4dc6ae72b802856ab80e0af6e9..6b1077c2a63faaaafe60a7d080024662daeb8f54 100644 (file)
@@ -337,10 +337,16 @@ enum ieee80211_bss_change {
  * enum ieee80211_event_type - event to be notified to the low level driver
  * @RSSI_EVENT: AP's rssi crossed the a threshold set by the driver.
  * @MLME_EVENT: event related to MLME
+ * @BAR_RX_EVENT: a BAR was received
+ * @BA_FRAME_TIMEOUT: Frames were released from the reordering buffer because
+ *     they timed out. This won't be called for each frame released, but only
+ *     once each time the timeout triggers.
  */
 enum ieee80211_event_type {
        RSSI_EVENT,
        MLME_EVENT,
+       BAR_RX_EVENT,
+       BA_FRAME_TIMEOUT,
 };
 
 /**
@@ -399,18 +405,32 @@ struct ieee80211_mlme_event {
        u16 reason;
 };
 
+/**
+ * struct ieee80211_ba_event - data attached for BlockAck related events
+ * @sta: pointer to the &ieee80211_sta to which this event relates
+ * @tid: the tid
+ * @ssn: the starting sequence number (for %BAR_RX_EVENT)
+ */
+struct ieee80211_ba_event {
+       struct ieee80211_sta *sta;
+       u16 tid;
+       u16 ssn;
+};
+
 /**
  * struct ieee80211_event - event to be sent to the driver
  * @type: The event itself. See &enum ieee80211_event_type.
  * @rssi: relevant if &type is %RSSI_EVENT
  * @mlme: relevant if &type is %AUTH_EVENT
- * @u:    union holding the above two fields
+ * @ba: relevant if &type is %BAR_RX_EVENT or %BA_FRAME_TIMEOUT
+ * @u:union holding the fields above
  */
 struct ieee80211_event {
        enum ieee80211_event_type type;
        union {
                struct ieee80211_rssi_event rssi;
                struct ieee80211_mlme_event mlme;
+               struct ieee80211_ba_event ba;
        } u;
 };
 
@@ -426,12 +446,8 @@ struct ieee80211_event {
  * @ibss_creator: indicates if a new IBSS network is being created
  * @aid: association ID number, valid only when @assoc is true
  * @use_cts_prot: use CTS protection
- * @use_short_preamble: use 802.11b short preamble;
- *     if the hardware cannot handle this it must set the
- *     IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE hardware flag
- * @use_short_slot: use short slot time (only relevant for ERP);
- *     if the hardware cannot handle this it must set the
- *     IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
+ * @use_short_preamble: use 802.11b short preamble
+ * @use_short_slot: use short slot time (only relevant for ERP)
  * @dtim_period: num of beacons before the next DTIM, for beaconing,
  *     valid in station mode only if after the driver was notified
  *     with the %BSS_CHANGED_BEACON_INFO flag, will be non-zero then.
@@ -854,6 +870,9 @@ struct ieee80211_tx_info {
                        u32 flags;
                        /* 4 bytes free */
                } control;
+               struct {
+                       u64 cookie;
+               } ack;
                struct {
                        struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
                        s32 ack_signal;
@@ -1459,6 +1478,9 @@ enum ieee80211_key_flags {
  *     wants to be given when a frame is transmitted and needs to be
  *     encrypted in hardware.
  * @cipher: The key's cipher suite selector.
+ * @tx_pn: PN used for TX on non-TKIP keys, may be used by the driver
+ *     as well if it needs to do software PN assignment by itself
+ *     (e.g. due to TSO)
  * @flags: key flags, see &enum ieee80211_key_flags.
  * @keyidx: the key index (0-3)
  * @keylen: key material length
@@ -1471,6 +1493,7 @@ enum ieee80211_key_flags {
  * @iv_len: The IV length for this key type
  */
 struct ieee80211_key_conf {
+       atomic64_t tx_pn;
        u32 cipher;
        u8 icv_len;
        u8 iv_len;
@@ -1481,6 +1504,47 @@ struct ieee80211_key_conf {
        u8 key[0];
 };
 
+#define IEEE80211_MAX_PN_LEN   16
+
+/**
+ * struct ieee80211_key_seq - key sequence counter
+ *
+ * @tkip: TKIP data, containing IV32 and IV16 in host byte order
+ * @ccmp: PN data, most significant byte first (big endian,
+ *     reverse order than in packet)
+ * @aes_cmac: PN data, most significant byte first (big endian,
+ *     reverse order than in packet)
+ * @aes_gmac: PN data, most significant byte first (big endian,
+ *     reverse order than in packet)
+ * @gcmp: PN data, most significant byte first (big endian,
+ *     reverse order than in packet)
+ * @hw: data for HW-only (e.g. cipher scheme) keys
+ */
+struct ieee80211_key_seq {
+       union {
+               struct {
+                       u32 iv32;
+                       u16 iv16;
+               } tkip;
+               struct {
+                       u8 pn[6];
+               } ccmp;
+               struct {
+                       u8 pn[6];
+               } aes_cmac;
+               struct {
+                       u8 pn[6];
+               } aes_gmac;
+               struct {
+                       u8 pn[6];
+               } gcmp;
+               struct {
+                       u8 seq[IEEE80211_MAX_PN_LEN];
+                       u8 seq_len;
+               } hw;
+       };
+};
+
 /**
  * struct ieee80211_cipher_scheme - cipher scheme
  *
@@ -1667,8 +1731,7 @@ struct ieee80211_tx_control {
  * @sta: station table entry, %NULL for per-vif queue
  * @tid: the TID for this queue (unused for per-vif queue)
  * @ac: the AC for this queue
- * @drv_priv: data area for driver use, will always be aligned to
- *     sizeof(void *).
+ * @drv_priv: driver private area, sized by hw->txq_data_size
  *
  * The driver can obtain packets from this queue by calling
  * ieee80211_tx_dequeue().
@@ -1717,13 +1780,6 @@ struct ieee80211_txq {
  *     multicast frames when there are power saving stations so that
  *     the driver can fetch them with ieee80211_get_buffered_bc().
  *
- * @IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE:
- *     Hardware is not capable of short slot operation on the 2.4 GHz band.
- *
- * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE:
- *     Hardware is not capable of receiving frames with short preamble on
- *     the 2.4 GHz band.
- *
  * @IEEE80211_HW_SIGNAL_UNSPEC:
  *     Hardware can provide signal values but we don't know its units. We
  *     expect values between 0 and @max_signal.
@@ -1798,6 +1854,10 @@ struct ieee80211_txq {
  *     the driver returns 1. This also forces the driver to advertise its
  *     supported cipher suites.
  *
+ * @IEEE80211_HW_SUPPORT_FAST_XMIT: The driver/hardware supports fast-xmit,
+ *     this currently requires only the ability to calculate the duration
+ *     for frames.
+ *
  * @IEEE80211_HW_QUEUE_CONTROL: The driver wants to control per-interface
  *     queue mapping in order to use different queues (not just one per AC)
  *     for different virtual interfaces. See the doc section on HW queue
@@ -1825,41 +1885,44 @@ struct ieee80211_txq {
  * @IEEE80211_HW_SUPPORTS_CLONED_SKBS: The driver will never modify the payload
  *     or tailroom of TX skbs without copying them first.
  *
- * @IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS: The HW supports scanning on all bands
+ * @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_2GHZ_SHORT_SLOT_INCAPABLE          = 1<<3,
-       IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE      = 1<<4,
-       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,
-       /* free slots */
-       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_SINGLE_HW_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
 };
 
 /**
@@ -1940,8 +2003,8 @@ enum ieee80211_hw_flags {
  *     Use the %IEEE80211_RADIOTAP_VHT_KNOWN_* values.
  *
  * @netdev_features: netdev features to be set in each netdev created
- *     from this HW. Note only HW checksum features are currently
- *     compatible with mac80211. Other feature bits will be rejected.
+ *     from this HW. Note that not all features are usable with mac80211,
+ *     other features will be rejected during HW registration.
  *
  * @uapsd_queues: This bitmap is included in (re)association frame to indicate
  *     for each access category if it is uAPSD trigger-enabled and delivery-
@@ -1966,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;
@@ -1992,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
  *
@@ -2505,10 +2582,6 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
  * stack. It is always safe to pass more frames than requested,
  * but this has negative impact on power consumption.
  *
- * @FIF_PROMISC_IN_BSS: promiscuous mode within your BSS,
- *     think of the BSS as your network segment and then this corresponds
- *     to the regular ethernet device promiscuous mode.
- *
  * @FIF_ALLMULTI: pass all multicast frames, this is used if requested
  *     by the user or if the hardware is not capable of filtering by
  *     multicast address.
@@ -2525,18 +2598,16 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
  *     mac80211 needs to do and the amount of CPU wakeups, so you should
  *     honour this flag if possible.
  *
- * @FIF_CONTROL: pass control frames (except for PS Poll), if PROMISC_IN_BSS
- *     is not set then only those addressed to this station.
+ * @FIF_CONTROL: pass control frames (except for PS Poll) addressed to this
+ *     station
  *
  * @FIF_OTHER_BSS: pass frames destined to other BSSes
  *
- * @FIF_PSPOLL: pass PS Poll frames, if PROMISC_IN_BSS is not set then only
- *     those addressed to this station.
+ * @FIF_PSPOLL: pass PS Poll frames
  *
  * @FIF_PROBE_REQ: pass probe request frames
  */
 enum ieee80211_filter_flags {
-       FIF_PROMISC_IN_BSS      = 1<<0,
        FIF_ALLMULTI            = 1<<1,
        FIF_FCSFAIL             = 1<<2,
        FIF_PLCPFAIL            = 1<<3,
@@ -2819,9 +2890,9 @@ enum ieee80211_reconfig_type {
  *     Returns zero if statistics are available.
  *     The callback can sleep.
  *
- * @get_tkip_seq: If your device implements TKIP encryption in hardware this
- *     callback should be provided to read the TKIP transmit IVs (both IV32
- *     and IV16) for the given key from hardware.
+ * @get_key_seq: If your device implements encryption in hardware and does
+ *     IV/PN assignment then this callback should be provided to read the
+ *     IV/PN for the given key from hardware.
  *     The callback must be atomic.
  *
  * @set_frag_threshold: Configuration of fragmentation threshold. Assign this
@@ -3004,7 +3075,7 @@ enum ieee80211_reconfig_type {
  *     The callback can sleep.
  * @event_callback: Notify driver about any event in mac80211. See
  *     &enum ieee80211_event_type for the different types.
- *     The callback can sleep.
+ *     The callback must be atomic.
  *
  * @release_buffered_frames: Release buffered frames according to the given
  *     parameters. In the case where the driver buffers some frames for
@@ -3220,8 +3291,9 @@ struct ieee80211_ops {
                                 struct ieee80211_vif *vif);
        int (*get_stats)(struct ieee80211_hw *hw,
                         struct ieee80211_low_level_stats *stats);
-       void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
-                            u32 *iv32, u16 *iv16);
+       void (*get_key_seq)(struct ieee80211_hw *hw,
+                           struct ieee80211_key_conf *key,
+                           struct ieee80211_key_seq *seq);
        int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
        int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
        int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -3469,14 +3541,15 @@ enum ieee80211_tpt_led_trigger_flags {
 };
 
 #ifdef CONFIG_MAC80211_LEDS
-char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
-char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
-char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw);
-char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw);
-char *__ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw,
-                                        unsigned int flags,
-                                        const struct ieee80211_tpt_blink *blink_table,
-                                        unsigned int blink_table_len);
+const char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
+const char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
+const char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw);
+const char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw);
+const char *
+__ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw,
+                                  unsigned int flags,
+                                  const struct ieee80211_tpt_blink *blink_table,
+                                  unsigned int blink_table_len);
 #endif
 /**
  * ieee80211_get_tx_led_name - get name of TX LED
@@ -3490,7 +3563,7 @@ char *__ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw,
  *
  * Return: The name of the LED trigger. %NULL if not configured for LEDs.
  */
-static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
+static inline const char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
 {
 #ifdef CONFIG_MAC80211_LEDS
        return __ieee80211_get_tx_led_name(hw);
@@ -3511,7 +3584,7 @@ static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
  *
  * Return: The name of the LED trigger. %NULL if not configured for LEDs.
  */
-static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
+static inline const char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
 {
 #ifdef CONFIG_MAC80211_LEDS
        return __ieee80211_get_rx_led_name(hw);
@@ -3532,7 +3605,7 @@ static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
  *
  * Return: The name of the LED trigger. %NULL if not configured for LEDs.
  */
-static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
+static inline const char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
 {
 #ifdef CONFIG_MAC80211_LEDS
        return __ieee80211_get_assoc_led_name(hw);
@@ -3553,7 +3626,7 @@ static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
  *
  * Return: The name of the LED trigger. %NULL if not configured for LEDs.
  */
-static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
+static inline const char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
 {
 #ifdef CONFIG_MAC80211_LEDS
        return __ieee80211_get_radio_led_name(hw);
@@ -3574,7 +3647,7 @@ static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
  *
  * Note: This function must be called before ieee80211_register_hw().
  */
-static inline char *
+static inline const char *
 ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags,
                                 const struct ieee80211_tpt_blink *blink_table,
                                 unsigned int blink_table_len)
@@ -4254,40 +4327,6 @@ void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
 void ieee80211_aes_cmac_calculate_k1_k2(struct ieee80211_key_conf *keyconf,
                                        u8 *k1, u8 *k2);
 
-/**
- * struct ieee80211_key_seq - key sequence counter
- *
- * @tkip: TKIP data, containing IV32 and IV16 in host byte order
- * @ccmp: PN data, most significant byte first (big endian,
- *     reverse order than in packet)
- * @aes_cmac: PN data, most significant byte first (big endian,
- *     reverse order than in packet)
- * @aes_gmac: PN data, most significant byte first (big endian,
- *     reverse order than in packet)
- * @gcmp: PN data, most significant byte first (big endian,
- *     reverse order than in packet)
- */
-struct ieee80211_key_seq {
-       union {
-               struct {
-                       u32 iv32;
-                       u16 iv16;
-               } tkip;
-               struct {
-                       u8 pn[6];
-               } ccmp;
-               struct {
-                       u8 pn[6];
-               } aes_cmac;
-               struct {
-                       u8 pn[6];
-               } aes_gmac;
-               struct {
-                       u8 pn[6];
-               } gcmp;
-       };
-};
-
 /**
  * ieee80211_get_key_tx_seq - get key TX sequence counter
  *