Skip to content

Commit

Permalink
Added debugfs file tx_amsdu to control tx amsdu.
Browse files Browse the repository at this point in the history
Signed-off-by: David Lin <dlin@marvell.com>
  • Loading branch information
yuhhaurlin committed Nov 6, 2017
1 parent cbb631e commit 574e24e
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 1 deletion.
1 change: 1 addition & 0 deletions core.c
Expand Up @@ -849,6 +849,7 @@ struct ieee80211_hw *mwl_alloc_hw(int bus_type,
priv->regulatory_set = false;
priv->disable_2g = false;
priv->disable_5g = false;
priv->tx_amsdu = true;
priv->hif.bus = bus_type;
priv->hif.ops = ops;
priv->hif.priv = (char *)priv + ALIGN(sizeof(*priv), NETDEV_ALIGN);
Expand Down
1 change: 1 addition & 0 deletions core.h
Expand Up @@ -178,6 +178,7 @@ struct mwl_priv {
bool disable_5g;
int antenna_tx;
int antenna_rx;
bool tx_amsdu;

struct mwl_tx_pwr_tbl tx_pwr_tbl[SYSADPT_MAX_NUM_CHANNELS];
bool cdd;
Expand Down
59 changes: 59 additions & 0 deletions debugfs.c
Expand Up @@ -468,6 +468,63 @@ static ssize_t mwl_debugfs_device_pwrtbl_read(struct file *file,
return ret;
}

static ssize_t mwl_debugfs_tx_amsdu_read(struct file *file,
char __user *ubuf,
size_t count, loff_t *ppos)
{
struct mwl_priv *priv = (struct mwl_priv *)file->private_data;
unsigned long page = get_zeroed_page(GFP_KERNEL);
char *p = (char *)page;
int len = 0, size = PAGE_SIZE;
ssize_t ret;

if (!p)
return -ENOMEM;

len += scnprintf(p + len, size - len, "\n");
len += scnprintf(p + len, size - len, "tx amsdu: %s\n",
priv->tx_amsdu ? "enable" : "disable");
len += scnprintf(p + len, size - len, "\n");

ret = simple_read_from_buffer(ubuf, count, ppos, p, len);
free_page(page);

return ret;
}

static ssize_t mwl_debugfs_tx_amsdu_write(struct file *file,
const char __user *ubuf,
size_t count, loff_t *ppos)
{
struct mwl_priv *priv = (struct mwl_priv *)file->private_data;
unsigned long addr = get_zeroed_page(GFP_KERNEL);
char *buf = (char *)addr;
size_t buf_size = min_t(size_t, count, PAGE_SIZE - 1);
int value;
ssize_t ret;

if (!buf)
return -ENOMEM;

if (copy_from_user(buf, ubuf, buf_size)) {
ret = -EFAULT;
goto err;
}

if (kstrtoint(buf, 0, &value)) {
ret = -EINVAL;
goto err;
}

priv->tx_amsdu = value ? true : false;

ret = count;

err:
free_page(addr);
return ret;
}

static ssize_t mwl_debugfs_dfs_channel_read(struct file *file,
char __user *ubuf,
size_t count, loff_t *ppos)
Expand Down Expand Up @@ -925,6 +982,7 @@ MWLWIFI_DEBUGFS_FILE_READ_OPS(sta);
MWLWIFI_DEBUGFS_FILE_READ_OPS(ampdu);
MWLWIFI_DEBUGFS_FILE_READ_OPS(stnid);
MWLWIFI_DEBUGFS_FILE_READ_OPS(device_pwrtbl);
MWLWIFI_DEBUGFS_FILE_OPS(tx_amsdu);
MWLWIFI_DEBUGFS_FILE_OPS(dfs_channel);
MWLWIFI_DEBUGFS_FILE_OPS(dfs_radar);
MWLWIFI_DEBUGFS_FILE_OPS(thermal);
Expand All @@ -950,6 +1008,7 @@ void mwl_debugfs_init(struct ieee80211_hw *hw)
MWLWIFI_DEBUGFS_ADD_FILE(ampdu);
MWLWIFI_DEBUGFS_ADD_FILE(stnid);
MWLWIFI_DEBUGFS_ADD_FILE(device_pwrtbl);
MWLWIFI_DEBUGFS_ADD_FILE(tx_amsdu);
MWLWIFI_DEBUGFS_ADD_FILE(dfs_channel);
MWLWIFI_DEBUGFS_ADD_FILE(dfs_radar);
MWLWIFI_DEBUGFS_ADD_FILE(thermal);
Expand Down
6 changes: 5 additions & 1 deletion mac80211.c
Expand Up @@ -730,7 +730,11 @@ static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
if (!rc) {
stream->state = AMPDU_STREAM_ACTIVE;
sta_info->check_ba_failed[tid] = 0;
sta_info->is_amsdu_allowed = params->amsdu;
if (priv->tx_amsdu)
sta_info->is_amsdu_allowed =
params->amsdu;
else
sta_info->is_amsdu_allowed = false;
} else {
spin_unlock_bh(&priv->stream_lock);
mwl_fwcmd_destroy_ba(hw, stream,
Expand Down

1 comment on commit 574e24e

@starcms
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To disable AMSDU, the following two lines need to be executed on every boot before any devices connect:

echo 0 > /sys/kernel/debug/ieee80211/phy0/mwlwifi/tx_amsdu
echo 0 > /sys/kernel/debug/ieee80211/phy1/mwlwifi/tx_amsdu

Please sign in to comment.