Skip to content

Commit

Permalink
Merge branch 'for-linville' of git://github.com/lucacoelho/wl12xx
Browse files Browse the repository at this point in the history
  • Loading branch information
John W. Linville committed Sep 19, 2011
2 parents 12e62d6 + 045c745 commit 376cf5d
Show file tree
Hide file tree
Showing 16 changed files with 358 additions and 158 deletions.
10 changes: 0 additions & 10 deletions drivers/net/wireless/wl12xx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ config WL12XX
If you choose to build a module, it will be called wl12xx. Say N if
unsure.

config WL12XX_HT
bool "TI wl12xx 802.11 HT support (EXPERIMENTAL)"
depends on WL12XX && EXPERIMENTAL
default n
---help---
This will enable 802.11 HT support in the wl12xx module.

That configuration is temporary due to the code incomplete and
still in testing process.

config WL12XX_SPI
tristate "TI wl12xx SPI support"
depends on WL12XX && SPI_MASTER
Expand Down
40 changes: 40 additions & 0 deletions drivers/net/wireless/wl12xx/acx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1691,3 +1691,43 @@ int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl)
kfree(acx);
return ret;
}

int wl12xx_acx_config_hangover(struct wl1271 *wl)
{
struct wl12xx_acx_config_hangover *acx;
struct conf_hangover_settings *conf = &wl->conf.hangover;
int ret;

wl1271_debug(DEBUG_ACX, "acx config hangover");

acx = kzalloc(sizeof(*acx), GFP_KERNEL);
if (!acx) {
ret = -ENOMEM;
goto out;
}

acx->recover_time = cpu_to_le32(conf->recover_time);
acx->hangover_period = conf->hangover_period;
acx->dynamic_mode = conf->dynamic_mode;
acx->early_termination_mode = conf->early_termination_mode;
acx->max_period = conf->max_period;
acx->min_period = conf->min_period;
acx->increase_delta = conf->increase_delta;
acx->decrease_delta = conf->decrease_delta;
acx->quiet_time = conf->quiet_time;
acx->increase_time = conf->increase_time;
acx->window_size = acx->window_size;

ret = wl1271_cmd_configure(wl, ACX_CONFIG_HANGOVER, acx,
sizeof(*acx));

if (ret < 0) {
wl1271_warning("acx config hangover failed: %d", ret);
goto out;
}

out:
kfree(acx);
return ret;

}
18 changes: 18 additions & 0 deletions drivers/net/wireless/wl12xx/acx.h
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,23 @@ struct wl12xx_acx_set_rate_mgmt_params {
u8 padding2[2];
} __packed;

struct wl12xx_acx_config_hangover {
struct acx_header header;

__le32 recover_time;
u8 hangover_period;
u8 dynamic_mode;
u8 early_termination_mode;
u8 max_period;
u8 min_period;
u8 increase_delta;
u8 decrease_delta;
u8 quiet_time;
u8 increase_time;
u8 window_size;
u8 padding[2];
} __packed;

enum {
ACX_WAKE_UP_CONDITIONS = 0x0002,
ACX_MEM_CFG = 0x0003,
Expand Down Expand Up @@ -1281,5 +1298,6 @@ int wl1271_acx_config_ps(struct wl1271 *wl);
int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr);
int wl1271_acx_fm_coex(struct wl1271 *wl);
int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl);
int wl12xx_acx_config_hangover(struct wl1271 *wl);

#endif /* __WL1271_ACX_H__ */
17 changes: 11 additions & 6 deletions drivers/net/wireless/wl12xx/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len)
struct acx_header *acx = buf;
int ret;

wl1271_debug(DEBUG_CMD, "cmd configure");
wl1271_debug(DEBUG_CMD, "cmd configure (%d)", id);

acx->id = cpu_to_le16(id);

Expand Down Expand Up @@ -1413,7 +1413,7 @@ int wl12xx_cmd_set_peer_state(struct wl1271 *wl, u8 hlid)
int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid)
{
struct wl12xx_cmd_add_peer *cmd;
int ret;
int i, ret;
u32 sta_rates;

wl1271_debug(DEBUG_CMD, "cmd add peer %d", (int)hlid);
Expand All @@ -1424,23 +1424,28 @@ int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid)
goto out;
}

/* currently we don't support UAPSD */
cmd->sp_len = 0;

memcpy(cmd->addr, sta->addr, ETH_ALEN);
cmd->bss_index = WL1271_AP_BSS_INDEX;
cmd->aid = sta->aid;
cmd->hlid = hlid;
cmd->sp_len = sta->max_sp;
cmd->wmm = sta->wme ? 1 : 0;

for (i = 0; i < NUM_ACCESS_CATEGORIES_COPY; i++)
if (sta->wme && (sta->uapsd_queues & BIT(i)))
cmd->psd_type[i] = WL1271_PSD_UPSD_TRIGGER;
else
cmd->psd_type[i] = WL1271_PSD_LEGACY;

sta_rates = sta->supp_rates[wl->band];
if (sta->ht_cap.ht_supported)
sta_rates |= sta->ht_cap.mcs.rx_mask[0] << HW_HT_RATES_OFFSET;

cmd->supported_rates =
cpu_to_le32(wl1271_tx_enabled_rates_get(wl, sta_rates));

wl1271_debug(DEBUG_CMD, "new peer rates: 0x%x", cmd->supported_rates);
wl1271_debug(DEBUG_CMD, "new peer rates=0x%x queues=0x%x",
cmd->supported_rates, sta->uapsd_queues);

ret = wl1271_cmd_send(wl, CMD_ADD_PEER, cmd, sizeof(*cmd), 0);
if (ret < 0) {
Expand Down
7 changes: 7 additions & 0 deletions drivers/net/wireless/wl12xx/cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,13 @@ enum wl12xx_ssid_type {
WL12XX_SSID_TYPE_ANY = 2,
};

enum wl1271_psd_type {
WL1271_PSD_LEGACY = 0,
WL1271_PSD_UPSD_TRIGGER = 1,
WL1271_PSD_LEGACY_PSPOLL = 2,
WL1271_PSD_SAPSD = 3
};

struct wl12xx_cmd_add_peer {
struct wl1271_cmd_header header;

Expand Down
23 changes: 15 additions & 8 deletions drivers/net/wireless/wl12xx/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -915,14 +915,6 @@ struct conf_conn_settings {
*/
u8 psm_entry_nullfunc_retries;

/*
* Specifies the time to linger in active mode after successfully
* transmitting the PSM entry null-func frame.
*
* Range 0 - 255 TU's
*/
u8 psm_entry_hangover_period;

/*
*
* Specifies the interval of the connection keep-alive null-func
Expand Down Expand Up @@ -1236,6 +1228,20 @@ struct conf_rate_policy_settings {
u8 rate_retry_policy[ACX_RATE_MGMT_NUM_OF_RATES];
};

struct conf_hangover_settings {
u32 recover_time;
u8 hangover_period;
u8 dynamic_mode;
u8 early_termination_mode;
u8 max_period;
u8 min_period;
u8 increase_delta;
u8 decrease_delta;
u8 quiet_time;
u8 increase_time;
u8 window_size;
};

struct conf_drv_settings {
struct conf_sg_settings sg;
struct conf_rx_settings rx;
Expand All @@ -1254,6 +1260,7 @@ struct conf_drv_settings {
struct conf_rx_streaming_settings rx_streaming;
struct conf_fwlog fwlog;
struct conf_rate_policy_settings rate;
struct conf_hangover_settings hangover;
u8 hci_io_ds;
};

Expand Down
88 changes: 47 additions & 41 deletions drivers/net/wireless/wl12xx/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,10 @@ static ssize_t gpio_power_write(struct file *file,
size_t count, loff_t *ppos)
{
struct wl1271 *wl = file->private_data;
char buf[10];
size_t len;
unsigned long value;
int ret;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len)) {
return -EFAULT;
}
buf[len] = '\0';

ret = kstrtoul(buf, 0, &value);
ret = kstrtoul_from_user(user_buf, count, 10, &value);
if (ret < 0) {
wl1271_warning("illegal value in gpio_power");
return -EINVAL;
Expand Down Expand Up @@ -427,17 +419,10 @@ static ssize_t dtim_interval_write(struct file *file,
size_t count, loff_t *ppos)
{
struct wl1271 *wl = file->private_data;
char buf[10];
size_t len;
unsigned long value;
int ret;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';

ret = kstrtoul(buf, 0, &value);
ret = kstrtoul_from_user(user_buf, count, 10, &value);
if (ret < 0) {
wl1271_warning("illegal value for dtim_interval");
return -EINVAL;
Expand Down Expand Up @@ -492,17 +477,10 @@ static ssize_t beacon_interval_write(struct file *file,
size_t count, loff_t *ppos)
{
struct wl1271 *wl = file->private_data;
char buf[10];
size_t len;
unsigned long value;
int ret;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';

ret = kstrtoul(buf, 0, &value);
ret = kstrtoul_from_user(user_buf, count, 10, &value);
if (ret < 0) {
wl1271_warning("illegal value for beacon_interval");
return -EINVAL;
Expand Down Expand Up @@ -542,17 +520,10 @@ static ssize_t rx_streaming_interval_write(struct file *file,
size_t count, loff_t *ppos)
{
struct wl1271 *wl = file->private_data;
char buf[10];
size_t len;
unsigned long value;
int ret;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';

ret = kstrtoul(buf, 0, &value);
ret = kstrtoul_from_user(user_buf, count, 10, &value);
if (ret < 0) {
wl1271_warning("illegal value in rx_streaming_interval!");
return -EINVAL;
Expand Down Expand Up @@ -601,17 +572,10 @@ static ssize_t rx_streaming_always_write(struct file *file,
size_t count, loff_t *ppos)
{
struct wl1271 *wl = file->private_data;
char buf[10];
size_t len;
unsigned long value;
int ret;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';

ret = kstrtoul(buf, 0, &value);
ret = kstrtoul_from_user(user_buf, count, 10, &value);
if (ret < 0) {
wl1271_warning("illegal value in rx_streaming_write!");
return -EINVAL;
Expand Down Expand Up @@ -655,6 +619,47 @@ static const struct file_operations rx_streaming_always_ops = {
.llseek = default_llseek,
};

static ssize_t beacon_filtering_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct wl1271 *wl = file->private_data;
char buf[10];
size_t len;
unsigned long value;
int ret;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';

ret = kstrtoul(buf, 0, &value);
if (ret < 0) {
wl1271_warning("illegal value for beacon_filtering!");
return -EINVAL;
}

mutex_lock(&wl->mutex);

ret = wl1271_ps_elp_wakeup(wl);
if (ret < 0)
goto out;

ret = wl1271_acx_beacon_filter_opt(wl, !!value);

wl1271_ps_elp_sleep(wl);
out:
mutex_unlock(&wl->mutex);
return count;
}

static const struct file_operations beacon_filtering_ops = {
.write = beacon_filtering_write,
.open = wl1271_open_file_generic,
.llseek = default_llseek,
};

static int wl1271_debugfs_add_files(struct wl1271 *wl,
struct dentry *rootdir)
{
Expand Down Expand Up @@ -767,6 +772,7 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl,
DEBUGFS_ADD(driver_state, rootdir);
DEBUGFS_ADD(dtim_interval, rootdir);
DEBUGFS_ADD(beacon_interval, rootdir);
DEBUGFS_ADD(beacon_filtering, rootdir);

streaming = debugfs_create_dir("rx_streaming", rootdir);
if (!streaming || IS_ERR(streaming))
Expand Down
Loading

0 comments on commit 376cf5d

Please sign in to comment.