Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89cea749 authored by Toke Høiland-Jørgensen's avatar Toke Høiland-Jørgensen Committed by Kalle Valo
Browse files

ath9k: Switch to mac80211 TXQ scheduling and airtime APIs



This moves the ath9k driver to use the mac80211 TXQ scheduling and
airtime accounting APIs, removing the corresponding state tracking
inside the driver.

Signed-off-by: default avatarToke Høiland-Jørgensen <toke@toke.dk>
[rmanohar@codeaurora.org: fixed checkpatch error and warnings]
Signed-off-by: default avatarRajkumar Manoharan <rmanohar@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent acc65103
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -112,8 +112,6 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
#define ATH_TXFIFO_DEPTH           8
#define ATH_TX_ERROR               0x01

#define ATH_AIRTIME_QUANTUM        300 /* usec */

/* Stop tx traffic 1ms before the GO goes away */
#define ATH_P2P_PS_STOP_TIME       1000

@@ -246,10 +244,8 @@ struct ath_atx_tid {
	s8 bar_index;
	bool active;
	bool clear_ps_filter;
	bool has_queued;
};

void __ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid);
void ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid);

struct ath_node {
@@ -263,12 +259,9 @@ struct ath_node {

	bool sleeping;
	bool no_ps_filter;
	s64 airtime_deficit[IEEE80211_NUM_ACS];
	u32 airtime_rx_start;

#ifdef CONFIG_ATH9K_STATION_STATISTICS
	struct ath_rx_rate_stats rx_rate_stats;
	struct ath_airtime_stats airtime_stats;
#endif
	u8 key_idx[4];

@@ -986,11 +979,6 @@ void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs);

#define ATH9K_NUM_CHANCTX  2 /* supports 2 operating channels */

#define AIRTIME_USE_TX		BIT(0)
#define AIRTIME_USE_RX		BIT(1)
#define AIRTIME_USE_NEW_QUEUES	BIT(2)
#define AIRTIME_ACTIVE(flags) (!!(flags & (AIRTIME_USE_TX|AIRTIME_USE_RX)))

struct ath_softc {
	struct ieee80211_hw *hw;
	struct device *dev;
@@ -1034,8 +1022,6 @@ struct ath_softc {
	short nbcnvifs;
	unsigned long ps_usecount;

	u16 airtime_flags; /* AIRTIME_* */

	struct ath_rx rx;
	struct ath_tx tx;
	struct ath_beacon beacon;
+0 −3
Original line number Diff line number Diff line
@@ -1443,9 +1443,6 @@ int ath9k_init_debug(struct ath_hw *ah)
#endif
	debugfs_create_file("tpc", 0600, sc->debug.debugfs_phy, sc, &fops_tpc);

	debugfs_create_u16("airtime_flags", 0600,
			   sc->debug.debugfs_phy, &sc->airtime_flags);

	debugfs_create_file("nf_override", 0600,
			    sc->debug.debugfs_phy, sc, &fops_nf_override);

+0 −8
Original line number Diff line number Diff line
@@ -319,20 +319,12 @@ ath9k_debug_sync_cause(struct ath_softc *sc, u32 sync_cause)
void ath_debug_rate_stats(struct ath_softc *sc,
			  struct ath_rx_status *rs,
			  struct sk_buff *skb);
void ath_debug_airtime(struct ath_softc *sc,
		       struct ath_node *an,
		       u32 rx, u32 tx);
#else
static inline void ath_debug_rate_stats(struct ath_softc *sc,
					struct ath_rx_status *rs,
					struct sk_buff *skb)
{
}
static inline void ath_debug_airtime(struct ath_softc *sc,
			      struct ath_node *an,
			      u32 rx, u32 tx)
{
}
#endif /* CONFIG_ATH9K_STATION_STATISTICS */

#endif /* DEBUG_H */
+0 −70
Original line number Diff line number Diff line
@@ -242,75 +242,6 @@ static const struct file_operations fops_node_recv = {
	.llseek = default_llseek,
};

void ath_debug_airtime(struct ath_softc *sc,
		struct ath_node *an,
		u32 rx,
		u32 tx)
{
	struct ath_airtime_stats *astats = &an->airtime_stats;

	astats->rx_airtime += rx;
	astats->tx_airtime += tx;
}

static ssize_t read_airtime(struct file *file, char __user *user_buf,
			size_t count, loff_t *ppos)
{
	struct ath_node *an = file->private_data;
	struct ath_airtime_stats *astats;
	static const char *qname[4] = {
		"VO", "VI", "BE", "BK"
	};
	u32 len = 0, size = 256;
	char *buf;
	size_t retval;
	int i;

	buf = kzalloc(size, GFP_KERNEL);
	if (buf == NULL)
		return -ENOMEM;

	astats = &an->airtime_stats;

	len += scnprintf(buf + len, size - len, "RX: %u us\n", astats->rx_airtime);
	len += scnprintf(buf + len, size - len, "TX: %u us\n", astats->tx_airtime);
	len += scnprintf(buf + len, size - len, "Deficit: ");
	for (i = 0; i < 4; i++)
		len += scnprintf(buf+len, size - len, "%s: %lld us ", qname[i], an->airtime_deficit[i]);
	if (len < size)
		buf[len++] = '\n';

	retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
	kfree(buf);

	return retval;
}

static ssize_t
write_airtime_reset_stub(struct file *file, const char __user *ubuf,
		   size_t count, loff_t *ppos)
{
	struct ath_node *an = file->private_data;
	struct ath_airtime_stats *astats;
	int i;

	astats = &an->airtime_stats;
	astats->rx_airtime = 0;
	astats->tx_airtime = 0;
	for (i = 0; i < 4; i++)
		an->airtime_deficit[i] = ATH_AIRTIME_QUANTUM;
	return count;
}

static const struct file_operations fops_airtime = {
	.read = read_airtime,
	.write = write_airtime_reset_stub,
	.open = simple_open,
	.owner = THIS_MODULE,
	.llseek = default_llseek,
};


void ath9k_sta_add_debugfs(struct ieee80211_hw *hw,
			   struct ieee80211_vif *vif,
			   struct ieee80211_sta *sta,
@@ -320,5 +251,4 @@ void ath9k_sta_add_debugfs(struct ieee80211_hw *hw,

	debugfs_create_file("node_aggr", 0444, dir, an, &fops_node_aggr);
	debugfs_create_file("node_recv", 0444, dir, an, &fops_node_recv);
	debugfs_create_file("airtime", 0644, dir, an, &fops_airtime);
}
+1 −2
Original line number Diff line number Diff line
@@ -676,8 +676,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,

	/* Will be cleared in ath9k_start() */
	set_bit(ATH_OP_INVALID, &common->op_flags);
	sc->airtime_flags = (AIRTIME_USE_TX | AIRTIME_USE_RX |
			     AIRTIME_USE_NEW_QUEUES);

	sc->sc_ah = ah;
	sc->dfs_detector = dfs_pattern_detector_init(common, NL80211_DFS_UNSET);
@@ -1013,6 +1011,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
	SET_IEEE80211_PERM_ADDR(hw, common->macaddr);

	wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
	wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS);
}

int ath9k_init_device(u16 devid, struct ath_softc *sc,
Loading