mirror of https://github.com/hak5/openwrt.git
mac80211: add the new 802.11n minstrel rate control implementation (optional, not used by default)
SVN-Revision: 19943lede-17.01
parent
6a11bbbac9
commit
cbd858715d
|
@ -10,3 +10,7 @@ config PACKAGE_ATH9K_DEBUG
|
|||
modprobe ath9k debug=0x00002000
|
||||
|
||||
Look in ath9k/core.h for possible debug masks
|
||||
|
||||
config PACKAGE_ATH9K_USE_MINSTREL
|
||||
bool "use the new minstrel_ht rate control for ath9k"
|
||||
depends PACKAGE_kmod-ath9k
|
||||
|
|
|
@ -23,6 +23,7 @@ PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
|
|||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_PACKAGE_kmod-mac80211 \
|
||||
CONFIG_PACKAGE_MAC80211_DEBUGFS \
|
||||
CONFIG_PACKAGE_ATH9K_USE_MINSTREL \
|
||||
CONFIG_PACKAGE_ATH_DEBUG \
|
||||
CONFIG_ATH_USER_REGD \
|
||||
|
||||
|
@ -519,7 +520,8 @@ BUILDFLAGS:= \
|
|||
$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),-DCONFIG_MAC80211_DEBUGFS -DCONFIG_ATH9K_DEBUGFS) \
|
||||
$(if $(CONFIG_PACKAGE_ATH_DEBUG),-DCONFIG_ATH_DEBUG) \
|
||||
-D__CONFIG_MAC80211_RC_DEFAULT=minstrel \
|
||||
$(if $(CONFIG_ATH_USER_REGD),-DATH_USER_REGD=1)
|
||||
$(if $(CONFIG_ATH_USER_REGD),-DATH_USER_REGD=1) \
|
||||
$(if $(CONFIG_PACKAGE_ATH9K_USE_MINSTREL),-DATH9K_USE_MINSTREL)
|
||||
|
||||
MAKE_OPTS:= \
|
||||
CROSS_COMPILE="$(KERNEL_CROSS)" \
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
--- a/drivers/net/wireless/ath/ath9k/xmit.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
|
||||
@@ -1947,10 +1947,10 @@ static void ath_tx_rc_status(struct ath_
|
||||
tx_rateindex = ds->ds_txstat.ts_rateindex;
|
||||
WARN_ON(tx_rateindex >= hw->max_rates);
|
||||
|
||||
- if (update_rc)
|
||||
- tx_info->pad[0] |= ATH_TX_INFO_UPDATE_RC;
|
||||
if (ds->ds_txstat.ts_status & ATH9K_TXERR_FILT)
|
||||
tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
|
||||
+ if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && update_rc)
|
||||
+ tx_info->flags |= IEEE80211_TX_STAT_AMPDU;
|
||||
|
||||
if ((ds->ds_txstat.ts_status & ATH9K_TXERR_FILT) == 0 &&
|
||||
(bf->bf_flags & ATH9K_TXDESC_NOACK) == 0 && update_rc) {
|
||||
--- a/drivers/net/wireless/ath/ath9k/rc.h
|
||||
+++ b/drivers/net/wireless/ath/ath9k/rc.h
|
||||
@@ -172,7 +172,6 @@ struct ath_rate_priv {
|
||||
|
||||
#define ATH_TX_INFO_FRAME_TYPE_INTERNAL (1 << 0)
|
||||
#define ATH_TX_INFO_FRAME_TYPE_PAUSE (1 << 1)
|
||||
-#define ATH_TX_INFO_UPDATE_RC (1 << 2)
|
||||
#define ATH_TX_INFO_XRETRY (1 << 3)
|
||||
#define ATH_TX_INFO_UNDERRUN (1 << 4)
|
||||
|
||||
--- a/drivers/net/wireless/ath/ath9k/rc.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/rc.c
|
||||
@@ -1226,8 +1226,12 @@ static void ath_tx_status(void *priv, st
|
||||
long_retry = rate->count - 1;
|
||||
}
|
||||
|
||||
- if (!priv_sta || !ieee80211_is_data(fc) ||
|
||||
- !(tx_info->pad[0] & ATH_TX_INFO_UPDATE_RC))
|
||||
+ if (!priv_sta || !ieee80211_is_data(fc))
|
||||
+ return;
|
||||
+
|
||||
+ /* This packet was aggregated but doesn't carry status info */
|
||||
+ if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) &&
|
||||
+ !(tx_info->flags & IEEE80211_TX_STAT_AMPDU))
|
||||
return;
|
||||
|
||||
if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED)
|
|
@ -0,0 +1,80 @@
|
|||
--- a/net/mac80211/rc80211_minstrel.h
|
||||
+++ b/net/mac80211/rc80211_minstrel.h
|
||||
@@ -80,6 +80,11 @@ struct minstrel_priv {
|
||||
unsigned int lookaround_rate_mrr;
|
||||
};
|
||||
|
||||
+struct minstrel_debugfs_info {
|
||||
+ size_t len;
|
||||
+ char buf[];
|
||||
+};
|
||||
+
|
||||
void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
|
||||
void minstrel_remove_sta_debugfs(void *priv, void *priv_sta);
|
||||
|
||||
--- a/net/mac80211/rc80211_minstrel_debugfs.c
|
||||
+++ b/net/mac80211/rc80211_minstrel_debugfs.c
|
||||
@@ -52,21 +52,15 @@
|
||||
#include <net/mac80211.h>
|
||||
#include "rc80211_minstrel.h"
|
||||
|
||||
-struct minstrel_stats_info {
|
||||
- struct minstrel_sta_info *mi;
|
||||
- char buf[4096];
|
||||
- size_t len;
|
||||
-};
|
||||
-
|
||||
static int
|
||||
minstrel_stats_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct minstrel_sta_info *mi = inode->i_private;
|
||||
- struct minstrel_stats_info *ms;
|
||||
+ struct minstrel_debugfs_info *ms;
|
||||
unsigned int i, tp, prob, eprob;
|
||||
char *p;
|
||||
|
||||
- ms = kmalloc(sizeof(*ms), GFP_KERNEL);
|
||||
+ ms = kmalloc(sizeof(*ms) + 4096, GFP_KERNEL);
|
||||
if (!ms)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -107,35 +101,18 @@ minstrel_stats_open(struct inode *inode,
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
-minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *o)
|
||||
+minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos)
|
||||
{
|
||||
- struct minstrel_stats_info *ms;
|
||||
- char *src;
|
||||
+ struct minstrel_debugfs_info *ms;
|
||||
|
||||
ms = file->private_data;
|
||||
- src = ms->buf;
|
||||
-
|
||||
- len = min(len, ms->len);
|
||||
- if (len <= *o)
|
||||
- return 0;
|
||||
-
|
||||
- src += *o;
|
||||
- len -= *o;
|
||||
- *o += len;
|
||||
-
|
||||
- if (copy_to_user(buf, src, len))
|
||||
- return -EFAULT;
|
||||
-
|
||||
- return len;
|
||||
+ return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len);
|
||||
}
|
||||
|
||||
static int
|
||||
minstrel_stats_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
- struct minstrel_stats_info *ms = file->private_data;
|
||||
-
|
||||
- kfree(ms);
|
||||
-
|
||||
+ kfree(file->private_data);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
--- a/net/mac80211/rc80211_minstrel.h
|
||||
+++ b/net/mac80211/rc80211_minstrel.h
|
||||
@@ -85,7 +85,13 @@ struct minstrel_debugfs_info {
|
||||
char buf[];
|
||||
};
|
||||
|
||||
+extern struct rate_control_ops mac80211_minstrel;
|
||||
void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
|
||||
void minstrel_remove_sta_debugfs(void *priv, void *priv_sta);
|
||||
|
||||
+/* debugfs */
|
||||
+int minstrel_stats_open(struct inode *inode, struct file *file);
|
||||
+ssize_t minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *o);
|
||||
+int minstrel_stats_release(struct inode *inode, struct file *file);
|
||||
+
|
||||
#endif
|
||||
--- a/net/mac80211/rc80211_minstrel.c
|
||||
+++ b/net/mac80211/rc80211_minstrel.c
|
||||
@@ -541,7 +541,7 @@ minstrel_free(void *priv)
|
||||
kfree(priv);
|
||||
}
|
||||
|
||||
-static struct rate_control_ops mac80211_minstrel = {
|
||||
+struct rate_control_ops mac80211_minstrel = {
|
||||
.name = "minstrel",
|
||||
.tx_status = minstrel_tx_status,
|
||||
.get_rate = minstrel_get_rate,
|
||||
--- a/net/mac80211/rc80211_minstrel_debugfs.c
|
||||
+++ b/net/mac80211/rc80211_minstrel_debugfs.c
|
||||
@@ -52,7 +52,7 @@
|
||||
#include <net/mac80211.h>
|
||||
#include "rc80211_minstrel.h"
|
||||
|
||||
-static int
|
||||
+int
|
||||
minstrel_stats_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct minstrel_sta_info *mi = inode->i_private;
|
||||
@@ -100,7 +100,7 @@ minstrel_stats_open(struct inode *inode,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static ssize_t
|
||||
+ssize_t
|
||||
minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos)
|
||||
{
|
||||
struct minstrel_debugfs_info *ms;
|
||||
@@ -109,7 +109,7 @@ minstrel_stats_read(struct file *file, c
|
||||
return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len);
|
||||
}
|
||||
|
||||
-static int
|
||||
+int
|
||||
minstrel_stats_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
kfree(file->private_data);
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,14 @@
|
|||
--- a/drivers/net/wireless/ath/ath9k/init.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/init.c
|
||||
@@ -655,7 +655,11 @@ void ath9k_set_hw_capab(struct ath_softc
|
||||
hw->sta_data_size = sizeof(struct ath_node);
|
||||
hw->vif_data_size = sizeof(struct ath_vif);
|
||||
|
||||
+#ifdef ATH9K_USE_MINSTREL
|
||||
+ hw->rate_control_algorithm = "minstrel_ht";
|
||||
+#else
|
||||
hw->rate_control_algorithm = "ath9k_rate_control";
|
||||
+#endif
|
||||
|
||||
if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes))
|
||||
hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
|
Loading…
Reference in New Issue