Skip to content

Commit

Permalink
wl12xx: add set_rate_mgmt_params acx
Browse files Browse the repository at this point in the history
Configure rate management parameters on hw init

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information
Eliad Peller authored and Luciano Coelho committed Aug 22, 2011
1 parent f42bd2c commit fa6ad9f
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 0 deletions.
42 changes: 42 additions & 0 deletions drivers/net/wireless/wl12xx/acx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1699,3 +1699,45 @@ int wl1271_acx_fm_coex(struct wl1271 *wl)
kfree(acx);
return ret;
}

int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl)
{
struct wl12xx_acx_set_rate_mgmt_params *acx = NULL;
struct conf_rate_policy_settings *conf = &wl->conf.rate;
int ret;

wl1271_debug(DEBUG_ACX, "acx set rate mgmt params");

acx = kzalloc(sizeof(*acx), GFP_KERNEL);
if (!acx)
return -ENOMEM;

acx->index = ACX_RATE_MGMT_ALL_PARAMS;
acx->rate_retry_score = cpu_to_le16(conf->rate_retry_score);
acx->per_add = cpu_to_le16(conf->per_add);
acx->per_th1 = cpu_to_le16(conf->per_th1);
acx->per_th2 = cpu_to_le16(conf->per_th2);
acx->max_per = cpu_to_le16(conf->max_per);
acx->inverse_curiosity_factor = conf->inverse_curiosity_factor;
acx->tx_fail_low_th = conf->tx_fail_low_th;
acx->tx_fail_high_th = conf->tx_fail_high_th;
acx->per_alpha_shift = conf->per_alpha_shift;
acx->per_add_shift = conf->per_add_shift;
acx->per_beta1_shift = conf->per_beta1_shift;
acx->per_beta2_shift = conf->per_beta2_shift;
acx->rate_check_up = conf->rate_check_up;
acx->rate_check_down = conf->rate_check_down;
memcpy(acx->rate_retry_policy, conf->rate_retry_policy,
sizeof(acx->rate_retry_policy));

ret = wl1271_cmd_configure(wl, ACX_SET_RATE_MGMT_PARAMS,
acx, sizeof(*acx));
if (ret < 0) {
wl1271_warning("acx set rate mgmt params failed: %d", ret);
goto out;
}

out:
kfree(acx);
return ret;
}
25 changes: 25 additions & 0 deletions drivers/net/wireless/wl12xx/acx.h
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,30 @@ struct wl1271_acx_fm_coex {
u8 swallow_clk_diff;
} __packed;

#define ACX_RATE_MGMT_ALL_PARAMS 0xff
struct wl12xx_acx_set_rate_mgmt_params {
struct acx_header header;

u8 index; /* 0xff to configure all params */
u8 padding1;
__le16 rate_retry_score;
__le16 per_add;
__le16 per_th1;
__le16 per_th2;
__le16 max_per;
u8 inverse_curiosity_factor;
u8 tx_fail_low_th;
u8 tx_fail_high_th;
u8 per_alpha_shift;
u8 per_add_shift;
u8 per_beta1_shift;
u8 per_beta2_shift;
u8 rate_check_up;
u8 rate_check_down;
u8 rate_retry_policy[ACX_RATE_MGMT_NUM_OF_RATES];
u8 padding2[2];
} __packed;

enum {
ACX_WAKE_UP_CONDITIONS = 0x0002,
ACX_MEM_CFG = 0x0003,
Expand Down Expand Up @@ -1294,5 +1318,6 @@ int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl);
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);

#endif /* __WL1271_ACX_H__ */
20 changes: 20 additions & 0 deletions drivers/net/wireless/wl12xx/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,25 @@ struct conf_fwlog {
u8 threshold;
};

#define ACX_RATE_MGMT_NUM_OF_RATES 13
struct conf_rate_policy_settings {
u16 rate_retry_score;
u16 per_add;
u16 per_th1;
u16 per_th2;
u16 max_per;
u8 inverse_curiosity_factor;
u8 tx_fail_low_th;
u8 tx_fail_high_th;
u8 per_alpha_shift;
u8 per_add_shift;
u8 per_beta1_shift;
u8 per_beta2_shift;
u8 rate_check_up;
u8 rate_check_down;
u8 rate_retry_policy[ACX_RATE_MGMT_NUM_OF_RATES];
};

struct conf_drv_settings {
struct conf_sg_settings sg;
struct conf_rx_settings rx;
Expand All @@ -1326,6 +1345,7 @@ struct conf_drv_settings {
struct conf_fm_coex fm_coex;
struct conf_rx_streaming_settings rx_streaming;
struct conf_fwlog fwlog;
struct conf_rate_policy_settings rate;
u8 hci_io_ds;
};

Expand Down
4 changes: 4 additions & 0 deletions drivers/net/wireless/wl12xx/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,10 @@ int wl1271_hw_init(struct wl1271 *wl)
if (ret < 0)
goto out_free_memmap;

ret = wl12xx_acx_set_rate_mgmt_params(wl);
if (ret < 0)
goto out_free_memmap;

/* Configure initiator BA sessions policies */
ret = wl1271_set_ba_policies(wl);
if (ret < 0)
Expand Down
21 changes: 21 additions & 0 deletions drivers/net/wireless/wl12xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,27 @@ static struct conf_drv_settings default_conf = {
.threshold = 0,
},
.hci_io_ds = HCI_IO_DS_6MA,
.rate = {
.rate_retry_score = 32000,
.per_add = 8192,
.per_th1 = 2048,
.per_th2 = 4096,
.max_per = 8100,
.inverse_curiosity_factor = 5,
.tx_fail_low_th = 4,
.tx_fail_high_th = 10,
.per_alpha_shift = 4,
.per_add_shift = 13,
.per_beta1_shift = 10,
.per_beta2_shift = 8,
.rate_check_up = 2,
.rate_check_down = 12,
.rate_retry_policy = {
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
},
},
};

static char *fwlog_param;
Expand Down

0 comments on commit fa6ad9f

Please sign in to comment.