diff options
author | Eliad Peller <eliad@wizery.com> | 2011-08-14 06:17:14 -0400 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2011-08-22 05:35:25 -0400 |
commit | fa6ad9f0f34b0754ce7551866b33587f077a2a51 (patch) | |
tree | 7f907a187e5a1f071e55be01089731f83daf9e75 | |
parent | f42bd2cbf1d5ff4b161ad2c59ff12d66558c8374 (diff) |
wl12xx: add set_rate_mgmt_params acx
Configure rate management parameters on hw init
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r-- | drivers/net/wireless/wl12xx/acx.c | 42 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/acx.h | 25 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/conf.h | 20 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/init.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 21 |
5 files changed, 112 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/acx.c b/drivers/net/wireless/wl12xx/acx.c index 968d2197ac81..a784ba6a8ef6 100644 --- a/drivers/net/wireless/wl12xx/acx.c +++ b/drivers/net/wireless/wl12xx/acx.c | |||
@@ -1699,3 +1699,45 @@ out: | |||
1699 | kfree(acx); | 1699 | kfree(acx); |
1700 | return ret; | 1700 | return ret; |
1701 | } | 1701 | } |
1702 | |||
1703 | int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl) | ||
1704 | { | ||
1705 | struct wl12xx_acx_set_rate_mgmt_params *acx = NULL; | ||
1706 | struct conf_rate_policy_settings *conf = &wl->conf.rate; | ||
1707 | int ret; | ||
1708 | |||
1709 | wl1271_debug(DEBUG_ACX, "acx set rate mgmt params"); | ||
1710 | |||
1711 | acx = kzalloc(sizeof(*acx), GFP_KERNEL); | ||
1712 | if (!acx) | ||
1713 | return -ENOMEM; | ||
1714 | |||
1715 | acx->index = ACX_RATE_MGMT_ALL_PARAMS; | ||
1716 | acx->rate_retry_score = cpu_to_le16(conf->rate_retry_score); | ||
1717 | acx->per_add = cpu_to_le16(conf->per_add); | ||
1718 | acx->per_th1 = cpu_to_le16(conf->per_th1); | ||
1719 | acx->per_th2 = cpu_to_le16(conf->per_th2); | ||
1720 | acx->max_per = cpu_to_le16(conf->max_per); | ||
1721 | acx->inverse_curiosity_factor = conf->inverse_curiosity_factor; | ||
1722 | acx->tx_fail_low_th = conf->tx_fail_low_th; | ||
1723 | acx->tx_fail_high_th = conf->tx_fail_high_th; | ||
1724 | acx->per_alpha_shift = conf->per_alpha_shift; | ||
1725 | acx->per_add_shift = conf->per_add_shift; | ||
1726 | acx->per_beta1_shift = conf->per_beta1_shift; | ||
1727 | acx->per_beta2_shift = conf->per_beta2_shift; | ||
1728 | acx->rate_check_up = conf->rate_check_up; | ||
1729 | acx->rate_check_down = conf->rate_check_down; | ||
1730 | memcpy(acx->rate_retry_policy, conf->rate_retry_policy, | ||
1731 | sizeof(acx->rate_retry_policy)); | ||
1732 | |||
1733 | ret = wl1271_cmd_configure(wl, ACX_SET_RATE_MGMT_PARAMS, | ||
1734 | acx, sizeof(*acx)); | ||
1735 | if (ret < 0) { | ||
1736 | wl1271_warning("acx set rate mgmt params failed: %d", ret); | ||
1737 | goto out; | ||
1738 | } | ||
1739 | |||
1740 | out: | ||
1741 | kfree(acx); | ||
1742 | return ret; | ||
1743 | } | ||
diff --git a/drivers/net/wireless/wl12xx/acx.h b/drivers/net/wireless/wl12xx/acx.h index 3aec410634e7..6909bc535a5d 100644 --- a/drivers/net/wireless/wl12xx/acx.h +++ b/drivers/net/wireless/wl12xx/acx.h | |||
@@ -1155,6 +1155,30 @@ struct wl1271_acx_fm_coex { | |||
1155 | u8 swallow_clk_diff; | 1155 | u8 swallow_clk_diff; |
1156 | } __packed; | 1156 | } __packed; |
1157 | 1157 | ||
1158 | #define ACX_RATE_MGMT_ALL_PARAMS 0xff | ||
1159 | struct wl12xx_acx_set_rate_mgmt_params { | ||
1160 | struct acx_header header; | ||
1161 | |||
1162 | u8 index; /* 0xff to configure all params */ | ||
1163 | u8 padding1; | ||
1164 | __le16 rate_retry_score; | ||
1165 | __le16 per_add; | ||
1166 | __le16 per_th1; | ||
1167 | __le16 per_th2; | ||
1168 | __le16 max_per; | ||
1169 | u8 inverse_curiosity_factor; | ||
1170 | u8 tx_fail_low_th; | ||
1171 | u8 tx_fail_high_th; | ||
1172 | u8 per_alpha_shift; | ||
1173 | u8 per_add_shift; | ||
1174 | u8 per_beta1_shift; | ||
1175 | u8 per_beta2_shift; | ||
1176 | u8 rate_check_up; | ||
1177 | u8 rate_check_down; | ||
1178 | u8 rate_retry_policy[ACX_RATE_MGMT_NUM_OF_RATES]; | ||
1179 | u8 padding2[2]; | ||
1180 | } __packed; | ||
1181 | |||
1158 | enum { | 1182 | enum { |
1159 | ACX_WAKE_UP_CONDITIONS = 0x0002, | 1183 | ACX_WAKE_UP_CONDITIONS = 0x0002, |
1160 | ACX_MEM_CFG = 0x0003, | 1184 | ACX_MEM_CFG = 0x0003, |
@@ -1294,5 +1318,6 @@ int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl); | |||
1294 | int wl1271_acx_config_ps(struct wl1271 *wl); | 1318 | int wl1271_acx_config_ps(struct wl1271 *wl); |
1295 | int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr); | 1319 | int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr); |
1296 | int wl1271_acx_fm_coex(struct wl1271 *wl); | 1320 | int wl1271_acx_fm_coex(struct wl1271 *wl); |
1321 | int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl); | ||
1297 | 1322 | ||
1298 | #endif /* __WL1271_ACX_H__ */ | 1323 | #endif /* __WL1271_ACX_H__ */ |
diff --git a/drivers/net/wireless/wl12xx/conf.h b/drivers/net/wireless/wl12xx/conf.h index 6080e01d92c6..30ee7d304bcc 100644 --- a/drivers/net/wireless/wl12xx/conf.h +++ b/drivers/net/wireless/wl12xx/conf.h | |||
@@ -1309,6 +1309,25 @@ struct conf_fwlog { | |||
1309 | u8 threshold; | 1309 | u8 threshold; |
1310 | }; | 1310 | }; |
1311 | 1311 | ||
1312 | #define ACX_RATE_MGMT_NUM_OF_RATES 13 | ||
1313 | struct conf_rate_policy_settings { | ||
1314 | u16 rate_retry_score; | ||
1315 | u16 per_add; | ||
1316 | u16 per_th1; | ||
1317 | u16 per_th2; | ||
1318 | u16 max_per; | ||
1319 | u8 inverse_curiosity_factor; | ||
1320 | u8 tx_fail_low_th; | ||
1321 | u8 tx_fail_high_th; | ||
1322 | u8 per_alpha_shift; | ||
1323 | u8 per_add_shift; | ||
1324 | u8 per_beta1_shift; | ||
1325 | u8 per_beta2_shift; | ||
1326 | u8 rate_check_up; | ||
1327 | u8 rate_check_down; | ||
1328 | u8 rate_retry_policy[ACX_RATE_MGMT_NUM_OF_RATES]; | ||
1329 | }; | ||
1330 | |||
1312 | struct conf_drv_settings { | 1331 | struct conf_drv_settings { |
1313 | struct conf_sg_settings sg; | 1332 | struct conf_sg_settings sg; |
1314 | struct conf_rx_settings rx; | 1333 | struct conf_rx_settings rx; |
@@ -1326,6 +1345,7 @@ struct conf_drv_settings { | |||
1326 | struct conf_fm_coex fm_coex; | 1345 | struct conf_fm_coex fm_coex; |
1327 | struct conf_rx_streaming_settings rx_streaming; | 1346 | struct conf_rx_streaming_settings rx_streaming; |
1328 | struct conf_fwlog fwlog; | 1347 | struct conf_fwlog fwlog; |
1348 | struct conf_rate_policy_settings rate; | ||
1329 | u8 hci_io_ds; | 1349 | u8 hci_io_ds; |
1330 | }; | 1350 | }; |
1331 | 1351 | ||
diff --git a/drivers/net/wireless/wl12xx/init.c b/drivers/net/wireless/wl12xx/init.c index 3a6660901c33..1bc246f42a65 100644 --- a/drivers/net/wireless/wl12xx/init.c +++ b/drivers/net/wireless/wl12xx/init.c | |||
@@ -715,6 +715,10 @@ int wl1271_hw_init(struct wl1271 *wl) | |||
715 | if (ret < 0) | 715 | if (ret < 0) |
716 | goto out_free_memmap; | 716 | goto out_free_memmap; |
717 | 717 | ||
718 | ret = wl12xx_acx_set_rate_mgmt_params(wl); | ||
719 | if (ret < 0) | ||
720 | goto out_free_memmap; | ||
721 | |||
718 | /* Configure initiator BA sessions policies */ | 722 | /* Configure initiator BA sessions policies */ |
719 | ret = wl1271_set_ba_policies(wl); | 723 | ret = wl1271_set_ba_policies(wl); |
720 | if (ret < 0) | 724 | if (ret < 0) |
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index d683bca9b308..3db191de3f51 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -379,6 +379,27 @@ static struct conf_drv_settings default_conf = { | |||
379 | .threshold = 0, | 379 | .threshold = 0, |
380 | }, | 380 | }, |
381 | .hci_io_ds = HCI_IO_DS_6MA, | 381 | .hci_io_ds = HCI_IO_DS_6MA, |
382 | .rate = { | ||
383 | .rate_retry_score = 32000, | ||
384 | .per_add = 8192, | ||
385 | .per_th1 = 2048, | ||
386 | .per_th2 = 4096, | ||
387 | .max_per = 8100, | ||
388 | .inverse_curiosity_factor = 5, | ||
389 | .tx_fail_low_th = 4, | ||
390 | .tx_fail_high_th = 10, | ||
391 | .per_alpha_shift = 4, | ||
392 | .per_add_shift = 13, | ||
393 | .per_beta1_shift = 10, | ||
394 | .per_beta2_shift = 8, | ||
395 | .rate_check_up = 2, | ||
396 | .rate_check_down = 12, | ||
397 | .rate_retry_policy = { | ||
398 | 0x00, 0x00, 0x00, 0x00, 0x00, | ||
399 | 0x00, 0x00, 0x00, 0x00, 0x00, | ||
400 | 0x00, 0x00, 0x00, | ||
401 | }, | ||
402 | }, | ||
382 | }; | 403 | }; |
383 | 404 | ||
384 | static char *fwlog_param; | 405 | static char *fwlog_param; |