2014-11-19 20:17:01 +00:00
|
|
|
From: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
Date: Tue, 18 Nov 2014 23:58:51 +0100
|
|
|
|
Subject: [PATCH] mac80211: add an intermediate software queue implementation
|
|
|
|
|
|
|
|
This allows drivers to request per-vif and per-sta-tid queues from which
|
|
|
|
they can pull frames. This makes it easier to keep the hardware queues
|
|
|
|
short, and to improve fairness between clients and vifs.
|
|
|
|
|
|
|
|
The task of scheduling packet transmission is left up to the driver -
|
|
|
|
queueing is controlled by mac80211. Drivers can only dequeue packets by
|
|
|
|
calling ieee80211_tx_dequeue. This makes it possible to add active queue
|
|
|
|
management later without changing drivers using this code.
|
|
|
|
|
|
|
|
This can also be used as a starting point to implement A-MSDU
|
|
|
|
aggregation in a way that does not add artificially induced latency.
|
|
|
|
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
---
|
|
|
|
|
|
|
|
--- a/include/net/mac80211.h
|
|
|
|
+++ b/include/net/mac80211.h
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -84,6 +84,39 @@
|
2015-03-17 17:14:43 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * DOC: mac80211 software tx queueing
|
|
|
|
+ *
|
|
|
|
+ * mac80211 provides an optional intermediate queueing implementation designed
|
|
|
|
+ * to allow the driver to keep hardware queues short and provide some fairness
|
|
|
|
+ * between different stations/interfaces.
|
|
|
|
+ * In this model, the driver pulls data frames from the mac80211 queue instead
|
|
|
|
+ * of letting mac80211 push them via drv_tx().
|
|
|
|
+ * Other frames (e.g. control or management) are still pushed using drv_tx().
|
|
|
|
+ *
|
2015-04-03 19:42:33 +00:00
|
|
|
+ * Drivers indicate that they use this model by implementing the .wake_tx_queue
|
|
|
|
+ * driver operation.
|
|
|
|
+ *
|
2015-03-17 17:14:43 +00:00
|
|
|
+ * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with a
|
|
|
|
+ * single per-vif queue for multicast data frames.
|
|
|
|
+ *
|
|
|
|
+ * The driver is expected to initialize its private per-queue data for stations
|
|
|
|
+ * and interfaces in the .add_interface and .sta_add ops.
|
|
|
|
+ *
|
2015-04-03 19:42:33 +00:00
|
|
|
+ * The driver can't access the queue directly. To dequeue a frame, it calls
|
2015-03-17 17:14:43 +00:00
|
|
|
+ * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it
|
|
|
|
+ * calls the .wake_tx_queue driver op.
|
|
|
|
+ *
|
|
|
|
+ * For AP powersave TIM handling, the driver only needs to indicate if it has
|
|
|
|
+ * buffered packets in the driver specific data structures by calling
|
|
|
|
+ * ieee80211_sta_set_buffered(). For frames buffered in the ieee80211_txq
|
2015-03-20 16:24:06 +00:00
|
|
|
+ * struct, mac80211 sets the appropriate TIM PVB bits and calls
|
|
|
|
+ * .release_buffered_frames().
|
2015-04-03 19:42:33 +00:00
|
|
|
+ * In that callback the driver is therefore expected to release its own
|
|
|
|
+ * buffered frames and afterwards also frames from the ieee80211_txq (obtained
|
|
|
|
+ * via the usual ieee80211_tx_dequeue).
|
2015-03-17 17:14:43 +00:00
|
|
|
+ */
|
|
|
|
+
|
|
|
|
struct device;
|
|
|
|
|
|
|
|
/**
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -1246,6 +1279,7 @@ enum ieee80211_vif_flags {
|
|
|
|
* monitor interface (if that is requested.)
|
|
|
|
* @drv_priv: data area for driver use, will always be aligned to
|
|
|
|
* sizeof(void *).
|
|
|
|
+ * @txq: the multicast data TX queue (if driver uses the TXQ abstraction)
|
|
|
|
*/
|
|
|
|
struct ieee80211_vif {
|
|
|
|
enum nl80211_iftype type;
|
|
|
|
@@ -1257,6 +1291,8 @@ struct ieee80211_vif {
|
2014-11-19 20:17:01 +00:00
|
|
|
u8 cab_queue;
|
|
|
|
u8 hw_queue[IEEE80211_NUM_ACS];
|
|
|
|
|
|
|
|
+ struct ieee80211_txq *txq;
|
|
|
|
+
|
|
|
|
struct ieee80211_chanctx_conf __rcu *chanctx_conf;
|
|
|
|
|
|
|
|
u32 driver_flags;
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -1501,6 +1537,7 @@ struct ieee80211_sta_rates {
|
|
|
|
* @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
|
|
|
|
* valid if the STA is a TDLS peer in the first place.
|
|
|
|
* @mfp: indicates whether the STA uses management frame protection or not.
|
|
|
|
+ * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
|
|
|
|
*/
|
|
|
|
struct ieee80211_sta {
|
|
|
|
u32 supp_rates[IEEE80211_NUM_BANDS];
|
|
|
|
@@ -1519,6 +1556,8 @@ struct ieee80211_sta {
|
2014-11-19 20:17:01 +00:00
|
|
|
bool tdls_initiator;
|
2015-03-11 15:02:47 +00:00
|
|
|
bool mfp;
|
2014-11-19 20:17:01 +00:00
|
|
|
|
|
|
|
+ struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
|
|
|
|
+
|
|
|
|
/* must be last */
|
|
|
|
u8 drv_priv[0] __aligned(sizeof(void *));
|
|
|
|
};
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -1547,6 +1586,27 @@ struct ieee80211_tx_control {
|
2014-11-19 20:17:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
+ * struct ieee80211_txq - Software intermediate tx queue
|
|
|
|
+ *
|
|
|
|
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
|
2015-03-20 16:24:06 +00:00
|
|
|
+ * @sta: station table entry, %NULL for per-vif queue
|
2015-03-17 17:14:43 +00:00
|
|
|
+ * @tid: the TID for this queue (unused for per-vif queue)
|
2014-11-19 20:17:01 +00:00
|
|
|
+ * @ac: the AC for this queue
|
|
|
|
+ *
|
|
|
|
+ * The driver can obtain packets from this queue by calling
|
|
|
|
+ * ieee80211_tx_dequeue().
|
|
|
|
+ */
|
|
|
|
+struct ieee80211_txq {
|
|
|
|
+ struct ieee80211_vif *vif;
|
|
|
|
+ struct ieee80211_sta *sta;
|
|
|
|
+ u8 tid;
|
|
|
|
+ u8 ac;
|
|
|
|
+
|
|
|
|
+ /* must be last */
|
|
|
|
+ u8 drv_priv[0] __aligned(sizeof(void *));
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
* enum ieee80211_hw_flags - hardware flags
|
|
|
|
*
|
|
|
|
* These flags are used to indicate hardware capabilities to
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -1770,6 +1830,8 @@ enum ieee80211_hw_flags {
|
2014-11-19 20:17:01 +00:00
|
|
|
* within &struct ieee80211_sta.
|
|
|
|
* @chanctx_data_size: size (in bytes) of the drv_priv data area
|
|
|
|
* within &struct ieee80211_chanctx_conf.
|
|
|
|
+ * @txq_data_size: size (in bytes) of the drv_priv data area
|
|
|
|
+ * within @struct ieee80211_txq.
|
|
|
|
*
|
|
|
|
* @max_rates: maximum number of alternate rate retry stages the hw
|
|
|
|
* can handle.
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -1818,6 +1880,9 @@ enum ieee80211_hw_flags {
|
2014-11-19 20:17:01 +00:00
|
|
|
* @n_cipher_schemes: a size of an array of cipher schemes definitions.
|
|
|
|
* @cipher_schemes: a pointer to an array of cipher scheme definitions
|
|
|
|
* supported by HW.
|
|
|
|
+ *
|
|
|
|
+ * @txq_ac_max_pending: maximum number of frames per AC pending in all txq
|
|
|
|
+ * entries for a vif.
|
|
|
|
*/
|
|
|
|
struct ieee80211_hw {
|
|
|
|
struct ieee80211_conf conf;
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -1830,6 +1895,7 @@ struct ieee80211_hw {
|
2014-11-19 20:17:01 +00:00
|
|
|
int vif_data_size;
|
|
|
|
int sta_data_size;
|
|
|
|
int chanctx_data_size;
|
|
|
|
+ int txq_data_size;
|
|
|
|
u16 queues;
|
|
|
|
u16 max_listen_interval;
|
|
|
|
s8 max_signal;
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -1846,6 +1912,7 @@ struct ieee80211_hw {
|
2014-11-19 20:17:01 +00:00
|
|
|
u8 uapsd_max_sp_len;
|
|
|
|
u8 n_cipher_schemes;
|
|
|
|
const struct ieee80211_cipher_scheme *cipher_schemes;
|
|
|
|
+ int txq_ac_max_pending;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -3007,6 +3074,8 @@ enum ieee80211_reconfig_type {
|
2015-03-11 15:02:47 +00:00
|
|
|
* response template is provided, together with the location of the
|
|
|
|
* switch-timing IE within the template. The skb can only be used within
|
|
|
|
* the function call.
|
2014-11-19 20:17:01 +00:00
|
|
|
+ *
|
|
|
|
+ * @wake_tx_queue: Called when new packets have been added to the queue.
|
|
|
|
*/
|
|
|
|
struct ieee80211_ops {
|
|
|
|
void (*tx)(struct ieee80211_hw *hw,
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -3238,6 +3307,9 @@ struct ieee80211_ops {
|
2015-03-11 15:02:47 +00:00
|
|
|
void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw,
|
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
struct ieee80211_tdls_ch_sw_params *params);
|
2014-11-19 20:17:01 +00:00
|
|
|
+
|
|
|
|
+ void (*wake_tx_queue)(struct ieee80211_hw *hw,
|
|
|
|
+ struct ieee80211_txq *txq);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -5249,4 +5321,15 @@ void ieee80211_unreserve_tid(struct ieee
|
2014-11-19 20:17:01 +00:00
|
|
|
*/
|
|
|
|
size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
|
|
|
|
const u8 *ids, int n_ids, size_t offset);
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
|
|
|
|
+ *
|
|
|
|
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
|
2015-04-03 19:42:33 +00:00
|
|
|
+ * @txq: pointer obtained from station or virtual interface
|
2014-11-19 20:17:01 +00:00
|
|
|
+ *
|
2015-03-20 16:24:06 +00:00
|
|
|
+ * Returns the skb if successful, %NULL if no frame was available.
|
2014-11-19 20:17:01 +00:00
|
|
|
+ */
|
2015-03-11 15:02:47 +00:00
|
|
|
+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
|
|
|
|
+ struct ieee80211_txq *txq);
|
2014-11-19 20:17:01 +00:00
|
|
|
#endif /* MAC80211_H */
|
|
|
|
--- a/net/mac80211/driver-ops.h
|
|
|
|
+++ b/net/mac80211/driver-ops.h
|
2015-03-17 17:14:43 +00:00
|
|
|
@@ -1367,4 +1367,16 @@ drv_tdls_recv_channel_switch(struct ieee
|
2015-03-11 15:02:47 +00:00
|
|
|
trace_drv_return_void(local);
|
2014-11-19 20:17:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+static inline void drv_wake_tx_queue(struct ieee80211_local *local,
|
|
|
|
+ struct txq_info *txq)
|
|
|
|
+{
|
|
|
|
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
|
|
|
|
+
|
|
|
|
+ if (!check_sdata_in_driver(sdata))
|
|
|
|
+ return;
|
|
|
|
+
|
2015-04-03 19:42:33 +00:00
|
|
|
+ trace_drv_wake_tx_queue(local, sdata, txq);
|
2014-11-19 20:17:01 +00:00
|
|
|
+ local->ops->wake_tx_queue(&local->hw, &txq->txq);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
#endif /* __MAC80211_DRIVER_OPS */
|
|
|
|
--- a/net/mac80211/ieee80211_i.h
|
|
|
|
+++ b/net/mac80211/ieee80211_i.h
|
2015-03-17 17:14:43 +00:00
|
|
|
@@ -809,6 +809,19 @@ struct mac80211_qos_map {
|
2014-11-19 20:17:01 +00:00
|
|
|
struct rcu_head rcu_head;
|
|
|
|
};
|
|
|
|
|
2015-03-17 17:14:43 +00:00
|
|
|
+enum txq_info_flags {
|
|
|
|
+ IEEE80211_TXQ_STOP,
|
|
|
|
+ IEEE80211_TXQ_AMPDU,
|
|
|
|
+};
|
|
|
|
+
|
2014-11-19 20:17:01 +00:00
|
|
|
+struct txq_info {
|
|
|
|
+ struct sk_buff_head queue;
|
2015-03-17 17:14:43 +00:00
|
|
|
+ unsigned long flags;
|
2014-11-19 20:17:01 +00:00
|
|
|
+
|
|
|
|
+ /* keep last! */
|
|
|
|
+ struct ieee80211_txq txq;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
struct ieee80211_sub_if_data {
|
|
|
|
struct list_head list;
|
|
|
|
|
2015-03-17 17:14:43 +00:00
|
|
|
@@ -853,6 +866,7 @@ struct ieee80211_sub_if_data {
|
2014-11-19 20:17:01 +00:00
|
|
|
bool control_port_no_encrypt;
|
|
|
|
int encrypt_headroom;
|
|
|
|
|
2015-03-11 15:02:47 +00:00
|
|
|
+ atomic_t txqs_len[IEEE80211_NUM_ACS];
|
2014-11-19 20:17:01 +00:00
|
|
|
struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
|
|
|
|
struct mac80211_qos_map __rcu *qos_map;
|
|
|
|
|
2015-03-17 17:14:43 +00:00
|
|
|
@@ -1453,6 +1467,10 @@ static inline struct ieee80211_local *hw
|
|
|
|
return container_of(hw, struct ieee80211_local, hw);
|
|
|
|
}
|
|
|
|
|
|
|
|
+static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq)
|
|
|
|
+{
|
|
|
|
+ return container_of(txq, struct txq_info, txq);
|
|
|
|
+}
|
|
|
|
|
|
|
|
static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
|
|
|
|
{
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -1905,6 +1923,9 @@ static inline bool ieee80211_can_run_wor
|
2015-03-11 15:02:47 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-11-19 20:17:01 +00:00
|
|
|
+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
|
|
|
|
+ struct sta_info *sta,
|
|
|
|
+ struct txq_info *txq, int tid);
|
|
|
|
void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
|
|
|
|
u16 transaction, u16 auth_alg, u16 status,
|
2015-03-11 15:02:47 +00:00
|
|
|
const u8 *extra, size_t extra_len, const u8 *bssid,
|
2014-11-19 20:17:01 +00:00
|
|
|
--- a/net/mac80211/iface.c
|
|
|
|
+++ b/net/mac80211/iface.c
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -969,6 +969,13 @@ static void ieee80211_do_stop(struct iee
|
2014-11-19 20:17:01 +00:00
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
|
|
|
|
|
2015-03-20 16:24:06 +00:00
|
|
|
+ if (sdata->vif.txq) {
|
|
|
|
+ struct txq_info *txqi = to_txq_info(sdata->vif.txq);
|
|
|
|
+
|
|
|
|
+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
|
|
|
|
+ atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
|
|
|
|
+ }
|
2014-11-19 20:17:01 +00:00
|
|
|
+
|
|
|
|
if (local->open_count == 0)
|
|
|
|
ieee80211_clear_tx_pending(local);
|
|
|
|
|
2015-03-27 14:54:46 +00:00
|
|
|
@@ -1674,6 +1681,7 @@ int ieee80211_if_add(struct ieee80211_lo
|
|
|
|
{
|
|
|
|
struct net_device *ndev = NULL;
|
|
|
|
struct ieee80211_sub_if_data *sdata = NULL;
|
|
|
|
+ struct txq_info *txqi;
|
|
|
|
int ret, i;
|
|
|
|
int txqs = 1;
|
|
|
|
|
|
|
|
@@ -1693,10 +1701,18 @@ int ieee80211_if_add(struct ieee80211_lo
|
|
|
|
ieee80211_assign_perm_addr(local, wdev->address, type);
|
|
|
|
memcpy(sdata->vif.addr, wdev->address, ETH_ALEN);
|
|
|
|
} else {
|
|
|
|
+ int size = ALIGN(sizeof(*sdata) + local->hw.vif_data_size,
|
|
|
|
+ sizeof(void *));
|
|
|
|
+ int txq_size = 0;
|
|
|
|
+
|
|
|
|
+ if (local->ops->wake_tx_queue)
|
|
|
|
+ txq_size += sizeof(struct txq_info) +
|
|
|
|
+ local->hw.txq_data_size;
|
|
|
|
+
|
|
|
|
if (local->hw.queues >= IEEE80211_NUM_ACS)
|
|
|
|
txqs = IEEE80211_NUM_ACS;
|
|
|
|
|
|
|
|
- ndev = alloc_netdev_mqs(sizeof(*sdata) + local->hw.vif_data_size,
|
|
|
|
+ ndev = alloc_netdev_mqs(size + txq_size,
|
|
|
|
name, NET_NAME_UNKNOWN,
|
|
|
|
ieee80211_if_setup, txqs, 1);
|
|
|
|
if (!ndev)
|
2015-03-27 20:31:14 +00:00
|
|
|
@@ -1731,6 +1747,11 @@ int ieee80211_if_add(struct ieee80211_lo
|
2015-03-27 14:54:46 +00:00
|
|
|
memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN);
|
|
|
|
memcpy(sdata->name, ndev->name, IFNAMSIZ);
|
|
|
|
|
2015-03-27 20:31:14 +00:00
|
|
|
+ if (txq_size) {
|
|
|
|
+ txqi = netdev_priv(ndev) + size;
|
|
|
|
+ ieee80211_init_tx_queue(sdata, NULL, txqi, 0);
|
|
|
|
+ }
|
2015-03-27 14:54:46 +00:00
|
|
|
+
|
|
|
|
sdata->dev = ndev;
|
|
|
|
}
|
|
|
|
|
2014-11-19 20:17:01 +00:00
|
|
|
--- a/net/mac80211/main.c
|
|
|
|
+++ b/net/mac80211/main.c
|
2015-03-11 15:02:47 +00:00
|
|
|
@@ -1019,6 +1019,9 @@ int ieee80211_register_hw(struct ieee802
|
2014-11-19 20:17:01 +00:00
|
|
|
|
|
|
|
local->dynamic_ps_forced_timeout = -1;
|
|
|
|
|
|
|
|
+ if (!local->hw.txq_ac_max_pending)
|
|
|
|
+ local->hw.txq_ac_max_pending = 64;
|
|
|
|
+
|
|
|
|
result = ieee80211_wep_init(local);
|
|
|
|
if (result < 0)
|
|
|
|
wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
|
|
|
|
--- a/net/mac80211/sta_info.c
|
|
|
|
+++ b/net/mac80211/sta_info.c
|
2015-05-21 19:32:16 +00:00
|
|
|
@@ -118,6 +118,16 @@ static void __cleanup_single_sta(struct
|
2015-03-11 15:02:47 +00:00
|
|
|
atomic_dec(&ps->num_sta_ps);
|
2014-11-19 20:17:01 +00:00
|
|
|
}
|
|
|
|
|
2015-03-17 17:14:43 +00:00
|
|
|
+ if (sta->sta.txq[0]) {
|
2015-03-20 16:24:06 +00:00
|
|
|
+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
|
|
|
|
+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
|
|
|
|
+ int n = skb_queue_len(&txqi->queue);
|
|
|
|
+
|
|
|
|
+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
|
|
|
|
+ atomic_sub(n, &sdata->txqs_len[txqi->txq.ac]);
|
|
|
|
+ }
|
2014-11-19 20:17:01 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
|
|
|
|
local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]);
|
|
|
|
ieee80211_purge_tx_queue(&local->hw, &sta->ps_tx_buf[ac]);
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -234,6 +244,8 @@ void sta_info_free(struct ieee80211_loca
|
2014-11-19 20:17:01 +00:00
|
|
|
|
|
|
|
sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
|
|
|
|
|
2015-03-17 17:14:43 +00:00
|
|
|
+ if (sta->sta.txq[0])
|
|
|
|
+ kfree(to_txq_info(sta->sta.txq[0]));
|
2014-11-19 20:17:01 +00:00
|
|
|
kfree(rcu_dereference_raw(sta->sta.rates));
|
2015-03-11 15:02:47 +00:00
|
|
|
kfree(sta);
|
|
|
|
}
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -285,11 +297,12 @@ struct sta_info *sta_info_alloc(struct i
|
2014-11-19 20:17:01 +00:00
|
|
|
const u8 *addr, gfp_t gfp)
|
|
|
|
{
|
|
|
|
struct ieee80211_local *local = sdata->local;
|
|
|
|
+ struct ieee80211_hw *hw = &local->hw;
|
|
|
|
struct sta_info *sta;
|
|
|
|
struct timespec uptime;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
- sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp);
|
|
|
|
+ sta = kzalloc(sizeof(*sta) + hw->sta_data_size, gfp);
|
|
|
|
if (!sta)
|
|
|
|
return NULL;
|
|
|
|
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -321,11 +334,25 @@ struct sta_info *sta_info_alloc(struct i
|
2014-11-19 20:17:01 +00:00
|
|
|
for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++)
|
|
|
|
ewma_init(&sta->chain_signal_avg[i], 1024, 8);
|
|
|
|
|
2015-03-11 15:02:47 +00:00
|
|
|
- if (sta_prepare_rate_control(local, sta, gfp)) {
|
|
|
|
- kfree(sta);
|
|
|
|
- return NULL;
|
2014-11-19 20:17:01 +00:00
|
|
|
+ if (local->ops->wake_tx_queue) {
|
2015-03-13 05:17:06 +00:00
|
|
|
+ void *txq_data;
|
2014-11-19 20:17:01 +00:00
|
|
|
+ int size = sizeof(struct txq_info) +
|
|
|
|
+ ALIGN(hw->txq_data_size, sizeof(void *));
|
|
|
|
+
|
2015-03-17 17:14:43 +00:00
|
|
|
+ txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp);
|
2015-03-13 05:17:06 +00:00
|
|
|
+ if (!txq_data)
|
2014-11-19 20:17:01 +00:00
|
|
|
+ goto free;
|
|
|
|
+
|
2015-03-17 17:14:43 +00:00
|
|
|
+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
|
2015-03-13 05:17:06 +00:00
|
|
|
+ struct txq_info *txq = txq_data + i * size;
|
2015-03-20 16:24:06 +00:00
|
|
|
+
|
2014-11-19 20:17:01 +00:00
|
|
|
+ ieee80211_init_tx_queue(sdata, sta, txq, i);
|
|
|
|
+ }
|
2015-03-11 15:02:47 +00:00
|
|
|
}
|
2014-11-19 20:17:01 +00:00
|
|
|
|
2015-03-11 15:02:47 +00:00
|
|
|
+ if (sta_prepare_rate_control(local, sta, gfp))
|
|
|
|
+ goto free_txq;
|
|
|
|
+
|
|
|
|
for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
|
|
|
|
/*
|
|
|
|
* timer_to_tid must be initialized with identity mapping
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -346,7 +373,7 @@ struct sta_info *sta_info_alloc(struct i
|
2014-11-19 20:17:01 +00:00
|
|
|
if (sdata->vif.type == NL80211_IFTYPE_AP ||
|
|
|
|
sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
|
|
|
|
struct ieee80211_supported_band *sband =
|
|
|
|
- local->hw.wiphy->bands[ieee80211_get_sdata_band(sdata)];
|
|
|
|
+ hw->wiphy->bands[ieee80211_get_sdata_band(sdata)];
|
|
|
|
u8 smps = (sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >>
|
|
|
|
IEEE80211_HT_CAP_SM_PS_SHIFT;
|
|
|
|
/*
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -371,6 +398,13 @@ struct sta_info *sta_info_alloc(struct i
|
2015-03-11 15:02:47 +00:00
|
|
|
sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
|
|
|
|
|
|
|
|
return sta;
|
|
|
|
+
|
|
|
|
+free_txq:
|
2015-03-17 17:14:43 +00:00
|
|
|
+ if (sta->sta.txq[0])
|
|
|
|
+ kfree(to_txq_info(sta->sta.txq[0]));
|
2015-03-11 15:02:47 +00:00
|
|
|
+free:
|
|
|
|
+ kfree(sta);
|
|
|
|
+ return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int sta_info_insert_check(struct sta_info *sta)
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -640,6 +674,8 @@ static void __sta_info_recalc_tim(struct
|
2015-03-14 02:00:36 +00:00
|
|
|
|
|
|
|
indicate_tim |=
|
|
|
|
sta->driver_buffered_tids & tids;
|
|
|
|
+ indicate_tim |=
|
|
|
|
+ sta->txq_buffered_tids & tids;
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -1071,7 +1107,7 @@ void ieee80211_sta_ps_deliver_wakeup(str
|
2015-03-14 02:00:36 +00:00
|
|
|
struct ieee80211_sub_if_data *sdata = sta->sdata;
|
|
|
|
struct ieee80211_local *local = sdata->local;
|
|
|
|
struct sk_buff_head pending;
|
|
|
|
- int filtered = 0, buffered = 0, ac;
|
|
|
|
+ int filtered = 0, buffered = 0, ac, i;
|
|
|
|
unsigned long flags;
|
|
|
|
struct ps_data *ps;
|
|
|
|
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -1090,10 +1126,22 @@ void ieee80211_sta_ps_deliver_wakeup(str
|
2015-03-14 02:00:36 +00:00
|
|
|
|
|
|
|
BUILD_BUG_ON(BITS_TO_LONGS(IEEE80211_NUM_TIDS) > 1);
|
|
|
|
sta->driver_buffered_tids = 0;
|
|
|
|
+ sta->txq_buffered_tids = 0;
|
|
|
|
|
|
|
|
if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
|
|
|
|
drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta);
|
|
|
|
|
2015-03-17 17:14:43 +00:00
|
|
|
+ if (sta->sta.txq[0]) {
|
2015-03-14 02:00:36 +00:00
|
|
|
+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
|
2015-03-17 17:14:43 +00:00
|
|
|
+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
|
2015-03-14 02:00:36 +00:00
|
|
|
+
|
|
|
|
+ if (!skb_queue_len(&txqi->queue))
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ drv_wake_tx_queue(local, txqi);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
skb_queue_head_init(&pending);
|
|
|
|
|
|
|
|
/* sync with ieee80211_tx_h_unicast_ps_buf */
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -1275,8 +1323,10 @@ ieee80211_sta_ps_deliver_response(struct
|
2015-03-14 02:00:36 +00:00
|
|
|
/* if we already have frames from software, then we can't also
|
|
|
|
* release from hardware queues
|
|
|
|
*/
|
|
|
|
- if (skb_queue_empty(&frames))
|
|
|
|
+ if (skb_queue_empty(&frames)) {
|
|
|
|
driver_release_tids |= sta->driver_buffered_tids & tids;
|
|
|
|
+ driver_release_tids |= sta->txq_buffered_tids & tids;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (driver_release_tids) {
|
|
|
|
/* If the driver has data on more than one TID then
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -1447,6 +1497,9 @@ ieee80211_sta_ps_deliver_response(struct
|
2015-03-14 02:00:36 +00:00
|
|
|
|
|
|
|
sta_info_recalc_tim(sta);
|
|
|
|
} else {
|
|
|
|
+ unsigned long tids = sta->txq_buffered_tids & driver_release_tids;
|
2015-04-03 19:42:33 +00:00
|
|
|
+ int tid;
|
2015-03-14 02:00:36 +00:00
|
|
|
+
|
|
|
|
/*
|
|
|
|
* We need to release a frame that is buffered somewhere in the
|
|
|
|
* driver ... it'll have to handle that.
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -1466,8 +1519,22 @@ ieee80211_sta_ps_deliver_response(struct
|
2015-03-14 02:00:36 +00:00
|
|
|
* that the TID(s) became empty before returning here from the
|
|
|
|
* release function.
|
|
|
|
* Either way, however, when the driver tells us that the TID(s)
|
|
|
|
- * became empty we'll do the TIM recalculation.
|
|
|
|
+ * became empty or we find that a txq became empty, we'll do the
|
|
|
|
+ * TIM recalculation.
|
|
|
|
*/
|
|
|
|
+
|
2015-03-17 17:14:43 +00:00
|
|
|
+ if (!sta->sta.txq[0])
|
2015-03-14 02:00:36 +00:00
|
|
|
+ return;
|
|
|
|
+
|
2015-03-17 17:14:43 +00:00
|
|
|
+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
|
|
|
|
+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
|
2015-03-14 02:00:36 +00:00
|
|
|
+
|
|
|
|
+ if (!(tids & BIT(tid)) || skb_queue_len(&txqi->queue))
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ sta_info_recalc_tim(sta);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-19 20:17:01 +00:00
|
|
|
--- a/net/mac80211/sta_info.h
|
|
|
|
+++ b/net/mac80211/sta_info.h
|
2015-03-14 02:00:36 +00:00
|
|
|
@@ -274,6 +274,7 @@ struct sta_ampdu_mlme {
|
|
|
|
* entered power saving state, these are also delivered to
|
|
|
|
* the station when it leaves powersave or polls for frames
|
|
|
|
* @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
|
|
|
|
+ * @txq_buffered_tids: bitmap of TIDs that mac80211 has txq data buffered on
|
|
|
|
* @rx_packets: Number of MSDUs received from this STA
|
|
|
|
* @rx_bytes: Number of bytes received from this STA
|
|
|
|
* @last_rx: time (in jiffies) when last frame was received from this STA
|
2015-03-17 17:14:43 +00:00
|
|
|
@@ -368,6 +369,7 @@ struct sta_info {
|
2014-11-19 20:17:01 +00:00
|
|
|
struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS];
|
|
|
|
struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS];
|
|
|
|
unsigned long driver_buffered_tids;
|
2015-03-14 02:00:36 +00:00
|
|
|
+ unsigned long txq_buffered_tids;
|
2014-11-19 20:17:01 +00:00
|
|
|
|
|
|
|
/* Updated from RX path only, no locking requirements */
|
|
|
|
unsigned long rx_packets;
|
|
|
|
--- a/net/mac80211/trace.h
|
|
|
|
+++ b/net/mac80211/trace.h
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -2312,6 +2312,37 @@ TRACE_EVENT(drv_tdls_recv_channel_switch
|
2014-11-19 20:17:01 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2015-03-17 17:14:43 +00:00
|
|
|
+TRACE_EVENT(drv_wake_tx_queue,
|
2014-11-19 20:17:01 +00:00
|
|
|
+ TP_PROTO(struct ieee80211_local *local,
|
|
|
|
+ struct ieee80211_sub_if_data *sdata,
|
2015-04-03 19:42:33 +00:00
|
|
|
+ struct txq_info *txq),
|
2014-11-19 20:17:01 +00:00
|
|
|
+
|
2015-04-03 19:42:33 +00:00
|
|
|
+ TP_ARGS(local, sdata, txq),
|
2014-11-19 20:17:01 +00:00
|
|
|
+
|
|
|
|
+ TP_STRUCT__entry(
|
|
|
|
+ LOCAL_ENTRY
|
|
|
|
+ VIF_ENTRY
|
|
|
|
+ STA_ENTRY
|
2015-04-03 19:42:33 +00:00
|
|
|
+ __field(u8, ac)
|
2014-11-19 20:17:01 +00:00
|
|
|
+ __field(u8, tid)
|
|
|
|
+ ),
|
|
|
|
+
|
|
|
|
+ TP_fast_assign(
|
2015-04-03 19:42:33 +00:00
|
|
|
+ struct ieee80211_sta *sta = txq->txq.sta;
|
|
|
|
+
|
2014-11-19 20:17:01 +00:00
|
|
|
+ LOCAL_ASSIGN;
|
|
|
|
+ VIF_ASSIGN;
|
|
|
|
+ STA_ASSIGN;
|
2015-04-03 19:42:33 +00:00
|
|
|
+ __entry->ac = txq->txq.ac;
|
|
|
|
+ __entry->tid = txq->txq.tid;
|
2014-11-19 20:17:01 +00:00
|
|
|
+ ),
|
|
|
|
+
|
|
|
|
+ TP_printk(
|
2015-04-03 19:42:33 +00:00
|
|
|
+ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " ac:%d tid:%d",
|
|
|
|
+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->ac, __entry->tid
|
2014-11-19 20:17:01 +00:00
|
|
|
+ )
|
|
|
|
+);
|
|
|
|
+
|
|
|
|
#ifdef CPTCFG_MAC80211_MESSAGE_TRACING
|
|
|
|
#undef TRACE_SYSTEM
|
2015-03-11 15:02:47 +00:00
|
|
|
#define TRACE_SYSTEM mac80211_msg
|
2014-11-19 20:17:01 +00:00
|
|
|
--- a/net/mac80211/tx.c
|
|
|
|
+++ b/net/mac80211/tx.c
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -776,12 +776,22 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
|
2015-03-17 17:14:43 +00:00
|
|
|
return TX_CONTINUE;
|
|
|
|
}
|
|
|
|
|
2015-04-03 19:42:33 +00:00
|
|
|
+static __le16 ieee80211_tx_next_seq(struct sta_info *sta, int tid)
|
2015-03-17 17:14:43 +00:00
|
|
|
+{
|
|
|
|
+ u16 *seq = &sta->tid_seq[tid];
|
2015-04-03 19:42:33 +00:00
|
|
|
+ __le16 ret = cpu_to_le16(*seq);
|
2015-03-17 17:14:43 +00:00
|
|
|
+
|
|
|
|
+ /* Increase the sequence number. */
|
|
|
|
+ *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static ieee80211_tx_result debug_noinline
|
|
|
|
ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
|
|
|
|
{
|
|
|
|
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
|
|
|
|
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
|
|
|
|
- u16 *seq;
|
|
|
|
u8 *qc;
|
|
|
|
int tid;
|
|
|
|
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -832,13 +842,10 @@ ieee80211_tx_h_sequence(struct ieee80211
|
2015-03-17 17:14:43 +00:00
|
|
|
|
|
|
|
qc = ieee80211_get_qos_ctl(hdr);
|
|
|
|
tid = *qc & IEEE80211_QOS_CTL_TID_MASK;
|
|
|
|
- seq = &tx->sta->tid_seq[tid];
|
|
|
|
tx->sta->tx_msdu[tid]++;
|
|
|
|
|
|
|
|
- hdr->seq_ctrl = cpu_to_le16(*seq);
|
|
|
|
-
|
|
|
|
- /* Increase the sequence number. */
|
|
|
|
- *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
|
|
|
|
+ if (!tx->sta->sta.txq[0])
|
|
|
|
+ hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid);
|
|
|
|
|
|
|
|
return TX_CONTINUE;
|
|
|
|
}
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -1067,7 +1074,7 @@ static bool ieee80211_tx_prep_agg(struct
|
2015-03-17 17:14:43 +00:00
|
|
|
* nothing -- this aggregation session is being started
|
|
|
|
* but that might still fail with the driver
|
|
|
|
*/
|
|
|
|
- } else {
|
|
|
|
+ } else if (!tx->sta->sta.txq[tid]) {
|
|
|
|
spin_lock(&tx->sta->lock);
|
|
|
|
/*
|
|
|
|
* Need to re-check now, because we may get here
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -1201,13 +1208,102 @@ ieee80211_tx_prepare(struct ieee80211_su
|
2014-11-19 20:17:01 +00:00
|
|
|
return TX_CONTINUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
+static void ieee80211_drv_tx(struct ieee80211_local *local,
|
|
|
|
+ struct ieee80211_vif *vif,
|
|
|
|
+ struct ieee80211_sta *pubsta,
|
|
|
|
+ struct sk_buff *skb)
|
|
|
|
+{
|
|
|
|
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
|
|
|
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
|
2015-03-14 02:00:36 +00:00
|
|
|
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
2014-11-19 20:17:01 +00:00
|
|
|
+ struct ieee80211_tx_control control = {
|
2015-04-03 19:42:33 +00:00
|
|
|
+ .sta = pubsta,
|
2014-11-19 20:17:01 +00:00
|
|
|
+ };
|
2015-03-11 15:02:47 +00:00
|
|
|
+ struct ieee80211_txq *txq = NULL;
|
|
|
|
+ struct txq_info *txqi;
|
2014-11-19 20:17:01 +00:00
|
|
|
+ u8 ac;
|
|
|
|
+
|
2015-03-14 02:00:36 +00:00
|
|
|
+ if (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE)
|
|
|
|
+ goto tx_normal;
|
|
|
|
+
|
2015-03-17 17:14:43 +00:00
|
|
|
+ if (!ieee80211_is_data(hdr->frame_control))
|
2014-11-19 20:17:01 +00:00
|
|
|
+ goto tx_normal;
|
|
|
|
+
|
|
|
|
+ if (pubsta) {
|
|
|
|
+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
|
2015-03-20 16:24:06 +00:00
|
|
|
+
|
2015-03-11 15:02:47 +00:00
|
|
|
+ txq = pubsta->txq[tid];
|
2015-01-30 08:06:28 +00:00
|
|
|
+ } else if (vif) {
|
2015-03-11 15:02:47 +00:00
|
|
|
+ txq = vif->txq;
|
2014-11-19 20:17:01 +00:00
|
|
|
+ }
|
|
|
|
+
|
2015-03-11 15:02:47 +00:00
|
|
|
+ if (!txq)
|
2014-11-19 20:17:01 +00:00
|
|
|
+ goto tx_normal;
|
|
|
|
+
|
2015-03-11 15:02:47 +00:00
|
|
|
+ ac = txq->ac;
|
2015-03-20 16:24:06 +00:00
|
|
|
+ txqi = to_txq_info(txq);
|
2015-03-11 15:02:47 +00:00
|
|
|
+ atomic_inc(&sdata->txqs_len[ac]);
|
|
|
|
+ if (atomic_read(&sdata->txqs_len[ac]) >= local->hw.txq_ac_max_pending)
|
2014-11-19 20:17:01 +00:00
|
|
|
+ netif_stop_subqueue(sdata->dev, ac);
|
|
|
|
+
|
2015-03-11 15:02:47 +00:00
|
|
|
+ skb_queue_tail(&txqi->queue, skb);
|
|
|
|
+ drv_wake_tx_queue(local, txqi);
|
2014-11-19 20:17:01 +00:00
|
|
|
+
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+tx_normal:
|
|
|
|
+ drv_tx(local, &control, skb);
|
|
|
|
+}
|
|
|
|
+
|
2015-03-11 15:02:47 +00:00
|
|
|
+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
|
|
|
|
+ struct ieee80211_txq *txq)
|
2014-11-19 20:17:01 +00:00
|
|
|
+{
|
|
|
|
+ struct ieee80211_local *local = hw_to_local(hw);
|
2015-03-11 15:02:47 +00:00
|
|
|
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif);
|
|
|
|
+ struct txq_info *txqi = container_of(txq, struct txq_info, txq);
|
2015-03-17 17:14:43 +00:00
|
|
|
+ struct ieee80211_hdr *hdr;
|
|
|
|
+ struct sk_buff *skb = NULL;
|
2015-03-11 15:02:47 +00:00
|
|
|
+ u8 ac = txq->ac;
|
2014-11-19 20:17:01 +00:00
|
|
|
+
|
2015-03-17 17:14:43 +00:00
|
|
|
+ spin_lock_bh(&txqi->queue.lock);
|
|
|
|
+
|
|
|
|
+ if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags))
|
|
|
|
+ goto out;
|
|
|
|
+
|
|
|
|
+ skb = __skb_dequeue(&txqi->queue);
|
2015-03-11 15:02:47 +00:00
|
|
|
+ if (!skb)
|
2015-03-17 17:14:43 +00:00
|
|
|
+ goto out;
|
2014-11-19 20:17:01 +00:00
|
|
|
+
|
2015-03-11 15:02:47 +00:00
|
|
|
+ atomic_dec(&sdata->txqs_len[ac]);
|
2014-11-19 20:17:01 +00:00
|
|
|
+ if (__netif_subqueue_stopped(sdata->dev, ac))
|
|
|
|
+ ieee80211_propagate_queue_wake(local, sdata->vif.hw_queue[ac]);
|
|
|
|
+
|
2015-03-17 17:14:43 +00:00
|
|
|
+ hdr = (struct ieee80211_hdr *)skb->data;
|
|
|
|
+ if (txq->sta && ieee80211_is_data_qos(hdr->frame_control)) {
|
|
|
|
+ struct sta_info *sta = container_of(txq->sta, struct sta_info,
|
|
|
|
+ sta);
|
|
|
|
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
|
|
|
+
|
|
|
|
+ hdr->seq_ctrl = ieee80211_tx_next_seq(sta, txq->tid);
|
|
|
|
+ if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))
|
|
|
|
+ info->flags |= IEEE80211_TX_CTL_AMPDU;
|
|
|
|
+ else
|
|
|
|
+ info->flags &= ~IEEE80211_TX_CTL_AMPDU;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+out:
|
|
|
|
+ spin_unlock_bh(&txqi->queue.lock);
|
|
|
|
+
|
2015-03-11 15:02:47 +00:00
|
|
|
+ return skb;
|
2014-11-19 20:17:01 +00:00
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(ieee80211_tx_dequeue);
|
|
|
|
+
|
|
|
|
static bool ieee80211_tx_frags(struct ieee80211_local *local,
|
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
struct ieee80211_sta *sta,
|
|
|
|
struct sk_buff_head *skbs,
|
|
|
|
bool txpending)
|
|
|
|
{
|
|
|
|
- struct ieee80211_tx_control control;
|
|
|
|
struct sk_buff *skb, *tmp;
|
|
|
|
unsigned long flags;
|
|
|
|
|
2015-04-03 19:42:33 +00:00
|
|
|
@@ -1265,10 +1361,9 @@ static bool ieee80211_tx_frags(struct ie
|
2014-11-19 20:17:01 +00:00
|
|
|
spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
|
|
|
|
|
|
|
|
info->control.vif = vif;
|
|
|
|
- control.sta = sta;
|
|
|
|
|
|
|
|
__skb_unlink(skb, skbs);
|
|
|
|
- drv_tx(local, &control, skb);
|
|
|
|
+ ieee80211_drv_tx(local, vif, sta, skb);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
--- a/net/mac80211/util.c
|
|
|
|
+++ b/net/mac80211/util.c
|
|
|
|
@@ -308,6 +308,11 @@ void ieee80211_propagate_queue_wake(stru
|
|
|
|
for (ac = 0; ac < n_acs; ac++) {
|
|
|
|
int ac_queue = sdata->vif.hw_queue[ac];
|
|
|
|
|
|
|
|
+ if (local->ops->wake_tx_queue &&
|
2015-03-11 15:02:47 +00:00
|
|
|
+ (atomic_read(&sdata->txqs_len[ac]) >
|
2014-11-19 20:17:01 +00:00
|
|
|
+ local->hw.txq_ac_max_pending))
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
if (ac_queue == queue ||
|
|
|
|
(sdata->vif.cab_queue == queue &&
|
|
|
|
local->queue_stop_reasons[ac_queue] == 0 &&
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -3307,3 +3312,20 @@ u8 *ieee80211_add_wmm_info_ie(u8 *buf, u
|
2014-11-19 20:17:01 +00:00
|
|
|
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
|
|
|
|
+ struct sta_info *sta,
|
2015-03-11 15:02:47 +00:00
|
|
|
+ struct txq_info *txqi, int tid)
|
2014-11-19 20:17:01 +00:00
|
|
|
+{
|
2015-03-11 15:02:47 +00:00
|
|
|
+ skb_queue_head_init(&txqi->queue);
|
|
|
|
+ txqi->txq.vif = &sdata->vif;
|
2014-11-19 20:17:01 +00:00
|
|
|
+
|
|
|
|
+ if (sta) {
|
2015-03-11 15:02:47 +00:00
|
|
|
+ txqi->txq.sta = &sta->sta;
|
|
|
|
+ sta->sta.txq[tid] = &txqi->txq;
|
|
|
|
+ txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
|
2014-11-19 20:17:01 +00:00
|
|
|
+ } else {
|
2015-03-11 15:02:47 +00:00
|
|
|
+ sdata->vif.txq = &txqi->txq;
|
|
|
|
+ txqi->txq.ac = IEEE80211_AC_BE;
|
2014-11-19 20:17:01 +00:00
|
|
|
+ }
|
|
|
|
+}
|
2015-03-14 02:00:36 +00:00
|
|
|
--- a/net/mac80211/rx.c
|
|
|
|
+++ b/net/mac80211/rx.c
|
|
|
|
@@ -1176,6 +1176,7 @@ static void sta_ps_start(struct sta_info
|
|
|
|
struct ieee80211_sub_if_data *sdata = sta->sdata;
|
|
|
|
struct ieee80211_local *local = sdata->local;
|
|
|
|
struct ps_data *ps;
|
|
|
|
+ int tid;
|
|
|
|
|
|
|
|
if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
|
|
|
|
sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
|
2015-03-17 17:14:43 +00:00
|
|
|
@@ -1189,6 +1190,18 @@ static void sta_ps_start(struct sta_info
|
2015-03-14 02:00:36 +00:00
|
|
|
drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta);
|
|
|
|
ps_dbg(sdata, "STA %pM aid %d enters power save mode\n",
|
|
|
|
sta->sta.addr, sta->sta.aid);
|
|
|
|
+
|
2015-03-17 17:14:43 +00:00
|
|
|
+ if (!sta->sta.txq[0])
|
2015-03-14 02:00:36 +00:00
|
|
|
+ return;
|
|
|
|
+
|
2015-03-17 17:14:43 +00:00
|
|
|
+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
|
|
|
|
+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
|
2015-03-14 02:00:36 +00:00
|
|
|
+
|
|
|
|
+ if (!skb_queue_len(&txqi->queue))
|
|
|
|
+ set_bit(tid, &sta->txq_buffered_tids);
|
|
|
|
+ else
|
|
|
|
+ clear_bit(tid, &sta->txq_buffered_tids);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sta_ps_end(struct sta_info *sta)
|
2015-03-17 17:14:43 +00:00
|
|
|
--- a/net/mac80211/agg-tx.c
|
|
|
|
+++ b/net/mac80211/agg-tx.c
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -188,6 +188,43 @@ ieee80211_wake_queue_agg(struct ieee8021
|
2015-03-17 17:14:43 +00:00
|
|
|
__release(agg_queue);
|
|
|
|
}
|
|
|
|
|
|
|
|
+static void
|
|
|
|
+ieee80211_agg_stop_txq(struct sta_info *sta, int tid)
|
|
|
|
+{
|
|
|
|
+ struct ieee80211_txq *txq = sta->sta.txq[tid];
|
|
|
|
+ struct txq_info *txqi;
|
|
|
|
+
|
|
|
|
+ if (!txq)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ txqi = to_txq_info(txq);
|
2015-03-20 16:24:06 +00:00
|
|
|
+
|
|
|
|
+ /* Lock here to protect against further seqno updates on dequeue */
|
2015-03-17 17:14:43 +00:00
|
|
|
+ spin_lock_bh(&txqi->queue.lock);
|
|
|
|
+ set_bit(IEEE80211_TXQ_STOP, &txqi->flags);
|
|
|
|
+ spin_unlock_bh(&txqi->queue.lock);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void
|
|
|
|
+ieee80211_agg_start_txq(struct sta_info *sta, int tid, bool enable)
|
|
|
|
+{
|
|
|
|
+ struct ieee80211_txq *txq = sta->sta.txq[tid];
|
|
|
|
+ struct txq_info *txqi;
|
|
|
|
+
|
|
|
|
+ if (!txq)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ txqi = to_txq_info(txq);
|
|
|
|
+
|
|
|
|
+ if (enable)
|
|
|
|
+ set_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
|
|
|
|
+ else
|
|
|
|
+ clear_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
|
|
|
|
+
|
|
|
|
+ clear_bit(IEEE80211_TXQ_STOP, &txqi->flags);
|
|
|
|
+ drv_wake_tx_queue(sta->sdata->local, txqi);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* splice packets from the STA's pending to the local pending,
|
|
|
|
* requires a call to ieee80211_agg_splice_finish later
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -247,6 +284,7 @@ static void ieee80211_remove_tid_tx(stru
|
2015-03-17 17:14:43 +00:00
|
|
|
ieee80211_assign_tid_tx(sta, tid, NULL);
|
|
|
|
|
|
|
|
ieee80211_agg_splice_finish(sta->sdata, tid);
|
|
|
|
+ ieee80211_agg_start_txq(sta, tid, false);
|
|
|
|
|
|
|
|
kfree_rcu(tid_tx, rcu_head);
|
|
|
|
}
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -418,6 +456,8 @@ void ieee80211_tx_ba_session_handle_star
|
2015-03-17 17:14:43 +00:00
|
|
|
*/
|
|
|
|
clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);
|
|
|
|
|
|
|
|
+ ieee80211_agg_stop_txq(sta, tid);
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* Make sure no packets are being processed. This ensures that
|
|
|
|
* we have a valid starting sequence number and that in-flight
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -440,6 +480,8 @@ void ieee80211_tx_ba_session_handle_star
|
2015-03-17 17:14:43 +00:00
|
|
|
ieee80211_agg_splice_finish(sdata, tid);
|
|
|
|
spin_unlock_bh(&sta->lock);
|
|
|
|
|
|
|
|
+ ieee80211_agg_start_txq(sta, tid, false);
|
|
|
|
+
|
|
|
|
kfree_rcu(tid_tx, rcu_head);
|
|
|
|
return;
|
|
|
|
}
|
2015-03-20 16:24:06 +00:00
|
|
|
@@ -666,6 +708,8 @@ static void ieee80211_agg_tx_operational
|
2015-03-17 17:14:43 +00:00
|
|
|
ieee80211_agg_splice_finish(sta->sdata, tid);
|
|
|
|
|
|
|
|
spin_unlock_bh(&sta->lock);
|
|
|
|
+
|
|
|
|
+ ieee80211_agg_start_txq(sta, tid, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
|