2 * This file is part of wl1271
4 * Copyright (C) 2008-2009 Nokia Corporation
6 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 #include "wl1271_acx.h"
26 #include <linux/module.h>
27 #include <linux/platform_device.h>
28 #include <linux/crc7.h>
29 #include <linux/spi/spi.h>
30 #include <linux/slab.h>
33 #include "wl12xx_80211.h"
34 #include "wl1271_reg.h"
35 #include "wl1271_ps.h"
37 int wl1271_acx_wake_up_conditions(struct wl1271 *wl)
39 struct acx_wake_up_condition *wake_up;
42 wl1271_debug(DEBUG_ACX, "acx wake up conditions");
44 wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL);
50 wake_up->wake_up_event = wl->conf.conn.wake_up_event;
51 wake_up->listen_interval = wl->conf.conn.listen_interval;
53 ret = wl1271_cmd_configure(wl, ACX_WAKE_UP_CONDITIONS,
54 wake_up, sizeof(*wake_up));
56 wl1271_warning("could not set wake up conditions: %d", ret);
65 int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth)
67 struct acx_sleep_auth *auth;
70 wl1271_debug(DEBUG_ACX, "acx sleep auth");
72 auth = kzalloc(sizeof(*auth), GFP_KERNEL);
78 auth->sleep_auth = sleep_auth;
80 ret = wl1271_cmd_configure(wl, ACX_SLEEP_AUTH, auth, sizeof(*auth));
89 int wl1271_acx_tx_power(struct wl1271 *wl, int power)
91 struct acx_current_tx_power *acx;
94 wl1271_debug(DEBUG_ACX, "acx dot11_cur_tx_pwr");
96 if (power < 0 || power > 25)
99 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
105 acx->current_tx_power = power * 10;
107 ret = wl1271_cmd_configure(wl, DOT11_CUR_TX_PWR, acx, sizeof(*acx));
109 wl1271_warning("configure of tx power failed: %d", ret);
118 int wl1271_acx_feature_cfg(struct wl1271 *wl)
120 struct acx_feature_config *feature;
123 wl1271_debug(DEBUG_ACX, "acx feature cfg");
125 feature = kzalloc(sizeof(*feature), GFP_KERNEL);
131 /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */
132 feature->data_flow_options = 0;
133 feature->options = 0;
135 ret = wl1271_cmd_configure(wl, ACX_FEATURE_CFG,
136 feature, sizeof(*feature));
138 wl1271_error("Couldnt set HW encryption");
147 int wl1271_acx_mem_map(struct wl1271 *wl, struct acx_header *mem_map,
152 wl1271_debug(DEBUG_ACX, "acx mem map");
154 ret = wl1271_cmd_interrogate(wl, ACX_MEM_MAP, mem_map, len);
161 int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl)
163 struct acx_rx_msdu_lifetime *acx;
166 wl1271_debug(DEBUG_ACX, "acx rx msdu life time");
168 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
174 acx->lifetime = cpu_to_le32(wl->conf.rx.rx_msdu_life_time);
175 ret = wl1271_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME,
178 wl1271_warning("failed to set rx msdu life time: %d", ret);
187 int wl1271_acx_rx_config(struct wl1271 *wl, u32 config, u32 filter)
189 struct acx_rx_config *rx_config;
192 wl1271_debug(DEBUG_ACX, "acx rx config");
194 rx_config = kzalloc(sizeof(*rx_config), GFP_KERNEL);
200 rx_config->config_options = cpu_to_le32(config);
201 rx_config->filter_options = cpu_to_le32(filter);
203 ret = wl1271_cmd_configure(wl, ACX_RX_CFG,
204 rx_config, sizeof(*rx_config));
206 wl1271_warning("failed to set rx config: %d", ret);
215 int wl1271_acx_pd_threshold(struct wl1271 *wl)
217 struct acx_packet_detection *pd;
220 wl1271_debug(DEBUG_ACX, "acx data pd threshold");
222 pd = kzalloc(sizeof(*pd), GFP_KERNEL);
228 pd->threshold = cpu_to_le32(wl->conf.rx.packet_detection_threshold);
230 ret = wl1271_cmd_configure(wl, ACX_PD_THRESHOLD, pd, sizeof(*pd));
232 wl1271_warning("failed to set pd threshold: %d", ret);
241 int wl1271_acx_slot(struct wl1271 *wl, enum acx_slot_type slot_time)
243 struct acx_slot *slot;
246 wl1271_debug(DEBUG_ACX, "acx slot");
248 slot = kzalloc(sizeof(*slot), GFP_KERNEL);
254 slot->wone_index = STATION_WONE_INDEX;
255 slot->slot_time = slot_time;
257 ret = wl1271_cmd_configure(wl, ACX_SLOT, slot, sizeof(*slot));
259 wl1271_warning("failed to set slot time: %d", ret);
268 int wl1271_acx_group_address_tbl(struct wl1271 *wl, bool enable,
269 void *mc_list, u32 mc_list_len)
271 struct acx_dot11_grp_addr_tbl *acx;
274 wl1271_debug(DEBUG_ACX, "acx group address tbl");
276 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
283 acx->enabled = enable;
284 acx->num_groups = mc_list_len;
285 memcpy(acx->mac_table, mc_list, mc_list_len * ETH_ALEN);
287 ret = wl1271_cmd_configure(wl, DOT11_GROUP_ADDRESS_TBL,
290 wl1271_warning("failed to set group addr table: %d", ret);
299 int wl1271_acx_service_period_timeout(struct wl1271 *wl)
301 struct acx_rx_timeout *rx_timeout;
304 rx_timeout = kzalloc(sizeof(*rx_timeout), GFP_KERNEL);
310 wl1271_debug(DEBUG_ACX, "acx service period timeout");
312 rx_timeout->ps_poll_timeout = cpu_to_le16(wl->conf.rx.ps_poll_timeout);
313 rx_timeout->upsd_timeout = cpu_to_le16(wl->conf.rx.upsd_timeout);
315 ret = wl1271_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT,
316 rx_timeout, sizeof(*rx_timeout));
318 wl1271_warning("failed to set service period timeout: %d",
328 int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold)
330 struct acx_rts_threshold *rts;
333 wl1271_debug(DEBUG_ACX, "acx rts threshold");
335 rts = kzalloc(sizeof(*rts), GFP_KERNEL);
341 rts->threshold = cpu_to_le16(rts_threshold);
343 ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts));
345 wl1271_warning("failed to set rts threshold: %d", ret);
354 int wl1271_acx_dco_itrim_params(struct wl1271 *wl)
356 struct acx_dco_itrim_params *dco;
357 struct conf_itrim_settings *c = &wl->conf.itrim;
360 wl1271_debug(DEBUG_ACX, "acx dco itrim parameters");
362 dco = kzalloc(sizeof(*dco), GFP_KERNEL);
368 dco->enable = c->enable;
369 dco->timeout = cpu_to_le32(c->timeout);
371 ret = wl1271_cmd_configure(wl, ACX_SET_DCO_ITRIM_PARAMS,
374 wl1271_warning("failed to set dco itrim parameters: %d", ret);
383 int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, bool enable_filter)
385 struct acx_beacon_filter_option *beacon_filter = NULL;
388 wl1271_debug(DEBUG_ACX, "acx beacon filter opt");
391 wl->conf.conn.bcn_filt_mode == CONF_BCN_FILT_MODE_DISABLED)
394 beacon_filter = kzalloc(sizeof(*beacon_filter), GFP_KERNEL);
395 if (!beacon_filter) {
400 beacon_filter->enable = enable_filter;
403 * When set to zero, and the filter is enabled, beacons
404 * without the unicast TIM bit set are dropped.
406 beacon_filter->max_num_beacons = 0;
408 ret = wl1271_cmd_configure(wl, ACX_BEACON_FILTER_OPT,
409 beacon_filter, sizeof(*beacon_filter));
411 wl1271_warning("failed to set beacon filter opt: %d", ret);
416 kfree(beacon_filter);
420 int wl1271_acx_beacon_filter_table(struct wl1271 *wl)
422 struct acx_beacon_filter_ie_table *ie_table;
425 bool vendor_spec = false;
427 wl1271_debug(DEBUG_ACX, "acx beacon filter table");
429 ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL);
435 /* configure default beacon pass-through rules */
436 ie_table->num_ie = 0;
437 for (i = 0; i < wl->conf.conn.bcn_filt_ie_count; i++) {
438 struct conf_bcn_filt_rule *r = &(wl->conf.conn.bcn_filt_ie[i]);
439 ie_table->table[idx++] = r->ie;
440 ie_table->table[idx++] = r->rule;
442 if (r->ie == WLAN_EID_VENDOR_SPECIFIC) {
443 /* only one vendor specific ie allowed */
447 /* for vendor specific rules configure the
449 memcpy(&(ie_table->table[idx]), r->oui,
450 CONF_BCN_IE_OUI_LEN);
451 idx += CONF_BCN_IE_OUI_LEN;
452 ie_table->table[idx++] = r->type;
453 memcpy(&(ie_table->table[idx]), r->version,
454 CONF_BCN_IE_VER_LEN);
455 idx += CONF_BCN_IE_VER_LEN;
462 ret = wl1271_cmd_configure(wl, ACX_BEACON_FILTER_TABLE,
463 ie_table, sizeof(*ie_table));
465 wl1271_warning("failed to set beacon filter table: %d", ret);
474 #define ACX_CONN_MONIT_DISABLE_VALUE 0xffffffff
476 int wl1271_acx_conn_monit_params(struct wl1271 *wl, bool enable)
478 struct acx_conn_monit_params *acx;
479 u32 threshold = ACX_CONN_MONIT_DISABLE_VALUE;
480 u32 timeout = ACX_CONN_MONIT_DISABLE_VALUE;
483 wl1271_debug(DEBUG_ACX, "acx connection monitor parameters: %s",
484 enable ? "enabled" : "disabled");
486 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
493 threshold = wl->conf.conn.synch_fail_thold;
494 timeout = wl->conf.conn.bss_lose_timeout;
497 acx->synch_fail_thold = cpu_to_le32(threshold);
498 acx->bss_lose_timeout = cpu_to_le32(timeout);
500 ret = wl1271_cmd_configure(wl, ACX_CONN_MONIT_PARAMS,
503 wl1271_warning("failed to set connection monitor "
504 "parameters: %d", ret);
514 int wl1271_acx_sg_enable(struct wl1271 *wl, bool enable)
516 struct acx_bt_wlan_coex *pta;
519 wl1271_debug(DEBUG_ACX, "acx sg enable");
521 pta = kzalloc(sizeof(*pta), GFP_KERNEL);
528 pta->enable = wl->conf.sg.state;
530 pta->enable = CONF_SG_DISABLE;
532 ret = wl1271_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta));
534 wl1271_warning("failed to set softgemini enable: %d", ret);
543 int wl1271_acx_sg_cfg(struct wl1271 *wl)
545 struct acx_bt_wlan_coex_param *param;
546 struct conf_sg_settings *c = &wl->conf.sg;
549 wl1271_debug(DEBUG_ACX, "acx sg cfg");
551 param = kzalloc(sizeof(*param), GFP_KERNEL);
557 /* BT-WLAN coext parameters */
558 for (i = 0; i < CONF_SG_PARAMS_MAX; i++)
559 param->params[i] = cpu_to_le32(c->params[i]);
560 param->param_idx = CONF_SG_PARAMS_ALL;
562 ret = wl1271_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param));
564 wl1271_warning("failed to set sg config: %d", ret);
573 int wl1271_acx_cca_threshold(struct wl1271 *wl)
575 struct acx_energy_detection *detection;
578 wl1271_debug(DEBUG_ACX, "acx cca threshold");
580 detection = kzalloc(sizeof(*detection), GFP_KERNEL);
586 detection->rx_cca_threshold = cpu_to_le16(wl->conf.rx.rx_cca_threshold);
587 detection->tx_energy_detection = wl->conf.tx.tx_energy_detection;
589 ret = wl1271_cmd_configure(wl, ACX_CCA_THRESHOLD,
590 detection, sizeof(*detection));
592 wl1271_warning("failed to set cca threshold: %d", ret);
601 int wl1271_acx_bcn_dtim_options(struct wl1271 *wl)
603 struct acx_beacon_broadcast *bb;
606 wl1271_debug(DEBUG_ACX, "acx bcn dtim options");
608 bb = kzalloc(sizeof(*bb), GFP_KERNEL);
614 bb->beacon_rx_timeout = cpu_to_le16(wl->conf.conn.beacon_rx_timeout);
615 bb->broadcast_timeout = cpu_to_le16(wl->conf.conn.broadcast_timeout);
616 bb->rx_broadcast_in_ps = wl->conf.conn.rx_broadcast_in_ps;
617 bb->ps_poll_threshold = wl->conf.conn.ps_poll_threshold;
619 ret = wl1271_cmd_configure(wl, ACX_BCN_DTIM_OPTIONS, bb, sizeof(*bb));
621 wl1271_warning("failed to set rx config: %d", ret);
630 int wl1271_acx_aid(struct wl1271 *wl, u16 aid)
632 struct acx_aid *acx_aid;
635 wl1271_debug(DEBUG_ACX, "acx aid");
637 acx_aid = kzalloc(sizeof(*acx_aid), GFP_KERNEL);
643 acx_aid->aid = cpu_to_le16(aid);
645 ret = wl1271_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid));
647 wl1271_warning("failed to set aid: %d", ret);
656 int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask)
658 struct acx_event_mask *mask;
661 wl1271_debug(DEBUG_ACX, "acx event mbox mask");
663 mask = kzalloc(sizeof(*mask), GFP_KERNEL);
669 /* high event mask is unused */
670 mask->high_event_mask = cpu_to_le32(0xffffffff);
671 mask->event_mask = cpu_to_le32(event_mask);
673 ret = wl1271_cmd_configure(wl, ACX_EVENT_MBOX_MASK,
674 mask, sizeof(*mask));
676 wl1271_warning("failed to set acx_event_mbox_mask: %d", ret);
685 int wl1271_acx_set_preamble(struct wl1271 *wl, enum acx_preamble_type preamble)
687 struct acx_preamble *acx;
690 wl1271_debug(DEBUG_ACX, "acx_set_preamble");
692 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
698 acx->preamble = preamble;
700 ret = wl1271_cmd_configure(wl, ACX_PREAMBLE_TYPE, acx, sizeof(*acx));
702 wl1271_warning("Setting of preamble failed: %d", ret);
711 int wl1271_acx_cts_protect(struct wl1271 *wl,
712 enum acx_ctsprotect_type ctsprotect)
714 struct acx_ctsprotect *acx;
717 wl1271_debug(DEBUG_ACX, "acx_set_ctsprotect");
719 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
725 acx->ctsprotect = ctsprotect;
727 ret = wl1271_cmd_configure(wl, ACX_CTS_PROTECTION, acx, sizeof(*acx));
729 wl1271_warning("Setting of ctsprotect failed: %d", ret);
738 int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats)
742 wl1271_debug(DEBUG_ACX, "acx statistics");
744 ret = wl1271_cmd_interrogate(wl, ACX_STATISTICS, stats,
747 wl1271_warning("acx statistics failed: %d", ret);
754 int wl1271_acx_rate_policies(struct wl1271 *wl)
756 struct acx_rate_policy *acx;
757 struct conf_tx_rate_class *c = &wl->conf.tx.rc_conf;
761 wl1271_debug(DEBUG_ACX, "acx rate policies");
763 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
770 /* configure one basic rate class */
771 idx = ACX_TX_BASIC_RATE;
772 acx->rate_class[idx].enabled_rates = cpu_to_le32(wl->basic_rate);
773 acx->rate_class[idx].short_retry_limit = c->short_retry_limit;
774 acx->rate_class[idx].long_retry_limit = c->long_retry_limit;
775 acx->rate_class[idx].aflags = c->aflags;
777 /* configure one AP supported rate class */
778 idx = ACX_TX_AP_FULL_RATE;
779 acx->rate_class[idx].enabled_rates = cpu_to_le32(wl->rate_set);
780 acx->rate_class[idx].short_retry_limit = c->short_retry_limit;
781 acx->rate_class[idx].long_retry_limit = c->long_retry_limit;
782 acx->rate_class[idx].aflags = c->aflags;
784 acx->rate_class_cnt = cpu_to_le32(ACX_TX_RATE_POLICY_CNT);
786 ret = wl1271_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx));
788 wl1271_warning("Setting of rate policies failed: %d", ret);
797 int wl1271_acx_ac_cfg(struct wl1271 *wl, u8 ac, u8 cw_min, u16 cw_max,
800 struct acx_ac_cfg *acx;
803 wl1271_debug(DEBUG_ACX, "acx ac cfg %d cw_ming %d cw_max %d "
804 "aifs %d txop %d", ac, cw_min, cw_max, aifsn, txop);
806 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
814 acx->cw_min = cw_min;
815 acx->cw_max = cpu_to_le16(cw_max);
817 acx->tx_op_limit = cpu_to_le16(txop);
819 ret = wl1271_cmd_configure(wl, ACX_AC_CFG, acx, sizeof(*acx));
821 wl1271_warning("acx ac cfg failed: %d", ret);
830 int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type,
831 u8 tsid, u8 ps_scheme, u8 ack_policy,
832 u32 apsd_conf0, u32 apsd_conf1)
834 struct acx_tid_config *acx;
837 wl1271_debug(DEBUG_ACX, "acx tid config");
839 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
846 acx->queue_id = queue_id;
847 acx->channel_type = channel_type;
849 acx->ps_scheme = ps_scheme;
850 acx->ack_policy = ack_policy;
851 acx->apsd_conf[0] = cpu_to_le32(apsd_conf0);
852 acx->apsd_conf[1] = cpu_to_le32(apsd_conf1);
854 ret = wl1271_cmd_configure(wl, ACX_TID_CFG, acx, sizeof(*acx));
856 wl1271_warning("Setting of tid config failed: %d", ret);
865 int wl1271_acx_frag_threshold(struct wl1271 *wl)
867 struct acx_frag_threshold *acx;
870 wl1271_debug(DEBUG_ACX, "acx frag threshold");
872 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
879 acx->frag_threshold = cpu_to_le16(wl->conf.tx.frag_threshold);
880 ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx));
882 wl1271_warning("Setting of frag threshold failed: %d", ret);
891 int wl1271_acx_tx_config_options(struct wl1271 *wl)
893 struct acx_tx_config_options *acx;
896 wl1271_debug(DEBUG_ACX, "acx tx config options");
898 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
905 acx->tx_compl_timeout = cpu_to_le16(wl->conf.tx.tx_compl_timeout);
906 acx->tx_compl_threshold = cpu_to_le16(wl->conf.tx.tx_compl_threshold);
907 ret = wl1271_cmd_configure(wl, ACX_TX_CONFIG_OPT, acx, sizeof(*acx));
909 wl1271_warning("Setting of tx options failed: %d", ret);
918 int wl1271_acx_mem_cfg(struct wl1271 *wl)
920 struct wl1271_acx_config_memory *mem_conf;
923 wl1271_debug(DEBUG_ACX, "wl1271 mem cfg");
925 mem_conf = kzalloc(sizeof(*mem_conf), GFP_KERNEL);
932 mem_conf->num_stations = DEFAULT_NUM_STATIONS;
933 mem_conf->rx_mem_block_num = ACX_RX_MEM_BLOCKS;
934 mem_conf->tx_min_mem_block_num = ACX_TX_MIN_MEM_BLOCKS;
935 mem_conf->num_ssid_profiles = ACX_NUM_SSID_PROFILES;
936 mem_conf->total_tx_descriptors = cpu_to_le32(ACX_TX_DESCRIPTORS);
938 ret = wl1271_cmd_configure(wl, ACX_MEM_CFG, mem_conf,
941 wl1271_warning("wl1271 mem config failed: %d", ret);
950 int wl1271_acx_init_mem_config(struct wl1271 *wl)
954 ret = wl1271_acx_mem_cfg(wl);
958 wl->target_mem_map = kzalloc(sizeof(struct wl1271_acx_mem_map),
960 if (!wl->target_mem_map) {
961 wl1271_error("couldn't allocate target memory map");
965 /* we now ask for the firmware built memory map */
966 ret = wl1271_acx_mem_map(wl, (void *)wl->target_mem_map,
967 sizeof(struct wl1271_acx_mem_map));
969 wl1271_error("couldn't retrieve firmware memory map");
970 kfree(wl->target_mem_map);
971 wl->target_mem_map = NULL;
975 /* initialize TX block book keeping */
976 wl->tx_blocks_available =
977 le32_to_cpu(wl->target_mem_map->num_tx_mem_blocks);
978 wl1271_debug(DEBUG_TX, "available tx blocks: %d",
979 wl->tx_blocks_available);
984 int wl1271_acx_init_rx_interrupt(struct wl1271 *wl)
986 struct wl1271_acx_rx_config_opt *rx_conf;
989 wl1271_debug(DEBUG_ACX, "wl1271 rx interrupt config");
991 rx_conf = kzalloc(sizeof(*rx_conf), GFP_KERNEL);
997 rx_conf->threshold = cpu_to_le16(wl->conf.rx.irq_pkt_threshold);
998 rx_conf->timeout = cpu_to_le16(wl->conf.rx.irq_timeout);
999 rx_conf->mblk_threshold = cpu_to_le16(wl->conf.rx.irq_blk_threshold);
1000 rx_conf->queue_type = wl->conf.rx.queue_type;
1002 ret = wl1271_cmd_configure(wl, ACX_RX_CONFIG_OPT, rx_conf,
1005 wl1271_warning("wl1271 rx config opt failed: %d", ret);
1014 int wl1271_acx_bet_enable(struct wl1271 *wl, bool enable)
1016 struct wl1271_acx_bet_enable *acx = NULL;
1019 wl1271_debug(DEBUG_ACX, "acx bet enable");
1021 if (enable && wl->conf.conn.bet_enable == CONF_BET_MODE_DISABLE)
1024 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
1030 acx->enable = enable ? CONF_BET_MODE_ENABLE : CONF_BET_MODE_DISABLE;
1031 acx->max_consecutive = wl->conf.conn.bet_max_consecutive;
1033 ret = wl1271_cmd_configure(wl, ACX_BET_ENABLE, acx, sizeof(*acx));
1035 wl1271_warning("acx bet enable failed: %d", ret);
1044 int wl1271_acx_arp_ip_filter(struct wl1271 *wl, bool enable, __be32 address)
1046 struct wl1271_acx_arp_filter *acx;
1049 wl1271_debug(DEBUG_ACX, "acx arp ip filter, enable: %d", enable);
1051 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
1057 acx->version = ACX_IPV4_VERSION;
1058 acx->enable = enable;
1061 memcpy(acx->address, &address, ACX_IPV4_ADDR_SIZE);
1063 ret = wl1271_cmd_configure(wl, ACX_ARP_IP_FILTER,
1066 wl1271_warning("failed to set arp ip filter: %d", ret);
1075 int wl1271_acx_pm_config(struct wl1271 *wl)
1077 struct wl1271_acx_pm_config *acx = NULL;
1078 struct conf_pm_config_settings *c = &wl->conf.pm_config;
1081 wl1271_debug(DEBUG_ACX, "acx pm config");
1083 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
1089 acx->host_clk_settling_time = cpu_to_le32(c->host_clk_settling_time);
1090 acx->host_fast_wakeup_support = c->host_fast_wakeup_support;
1092 ret = wl1271_cmd_configure(wl, ACX_PM_CONFIG, acx, sizeof(*acx));
1094 wl1271_warning("acx pm config failed: %d", ret);
1103 int wl1271_acx_keep_alive_mode(struct wl1271 *wl, bool enable)
1105 struct wl1271_acx_keep_alive_mode *acx = NULL;
1108 wl1271_debug(DEBUG_ACX, "acx keep alive mode: %d", enable);
1110 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
1116 acx->enabled = enable;
1118 ret = wl1271_cmd_configure(wl, ACX_KEEP_ALIVE_MODE, acx, sizeof(*acx));
1120 wl1271_warning("acx keep alive mode failed: %d", ret);
1129 int wl1271_acx_keep_alive_config(struct wl1271 *wl, u8 index, u8 tpl_valid)
1131 struct wl1271_acx_keep_alive_config *acx = NULL;
1134 wl1271_debug(DEBUG_ACX, "acx keep alive config");
1136 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
1142 acx->period = cpu_to_le32(wl->conf.conn.keep_alive_interval);
1144 acx->tpl_validation = tpl_valid;
1145 acx->trigger = ACX_KEEP_ALIVE_NO_TX;
1147 ret = wl1271_cmd_configure(wl, ACX_SET_KEEP_ALIVE_CONFIG,
1150 wl1271_warning("acx keep alive config failed: %d", ret);
1159 int wl1271_acx_rssi_snr_trigger(struct wl1271 *wl, bool enable,
1162 struct wl1271_acx_rssi_snr_trigger *acx = NULL;
1165 wl1271_debug(DEBUG_ACX, "acx rssi snr trigger");
1167 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
1173 wl->last_rssi_event = -1;
1175 acx->pacing = cpu_to_le16(wl->conf.roam_trigger.trigger_pacing);
1176 acx->metric = WL1271_ACX_TRIG_METRIC_RSSI_BEACON;
1177 acx->type = WL1271_ACX_TRIG_TYPE_EDGE;
1179 acx->enable = WL1271_ACX_TRIG_ENABLE;
1181 acx->enable = WL1271_ACX_TRIG_DISABLE;
1183 acx->index = WL1271_ACX_TRIG_IDX_RSSI;
1184 acx->dir = WL1271_ACX_TRIG_DIR_BIDIR;
1185 acx->threshold = cpu_to_le16(thold);
1186 acx->hysteresis = hyst;
1188 ret = wl1271_cmd_configure(wl, ACX_RSSI_SNR_TRIGGER, acx, sizeof(*acx));
1190 wl1271_warning("acx rssi snr trigger setting failed: %d", ret);
1199 int wl1271_acx_rssi_snr_avg_weights(struct wl1271 *wl)
1201 struct wl1271_acx_rssi_snr_avg_weights *acx = NULL;
1202 struct conf_roam_trigger_settings *c = &wl->conf.roam_trigger;
1205 wl1271_debug(DEBUG_ACX, "acx rssi snr avg weights");
1207 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
1213 acx->rssi_beacon = c->avg_weight_rssi_beacon;
1214 acx->rssi_data = c->avg_weight_rssi_data;
1215 acx->snr_beacon = c->avg_weight_snr_beacon;
1216 acx->snr_data = c->avg_weight_snr_data;
1218 ret = wl1271_cmd_configure(wl, ACX_RSSI_SNR_WEIGHTS, acx, sizeof(*acx));
1220 wl1271_warning("acx rssi snr trigger weights failed: %d", ret);
1229 int wl1271_acx_tsf_info(struct wl1271 *wl, u64 *mactime)
1231 struct wl1271_acx_fw_tsf_information *tsf_info;
1234 tsf_info = kzalloc(sizeof(*tsf_info), GFP_KERNEL);
1240 ret = wl1271_cmd_interrogate(wl, ACX_TSF_INFO,
1241 tsf_info, sizeof(*tsf_info));
1243 wl1271_warning("acx tsf info interrogate failed");
1247 *mactime = le32_to_cpu(tsf_info->current_tsf_low) |
1248 ((u64) le32_to_cpu(tsf_info->current_tsf_high) << 32);