1 // SPDX-License-Identifier: GPL-2.0-only
3 * This file is part of wl1271
5 * Copyright (C) 2008-2009 Nokia Corporation
7 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
12 #include <linux/module.h>
13 #include <linux/platform_device.h>
14 #include <linux/spi/spi.h>
15 #include <linux/slab.h>
19 #include "wl12xx_80211.h"
22 int wl1271_acx_wake_up_conditions(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
23 u8 wake_up_event
, u8 listen_interval
)
25 struct acx_wake_up_condition
*wake_up
;
28 wl1271_debug(DEBUG_ACX
, "acx wake up conditions (wake_up_event %d listen_interval %d)",
29 wake_up_event
, listen_interval
);
31 wake_up
= kzalloc(sizeof(*wake_up
), GFP_KERNEL
);
37 wake_up
->role_id
= wlvif
->role_id
;
38 wake_up
->wake_up_event
= wake_up_event
;
39 wake_up
->listen_interval
= listen_interval
;
41 ret
= wl1271_cmd_configure(wl
, ACX_WAKE_UP_CONDITIONS
,
42 wake_up
, sizeof(*wake_up
));
44 wl1271_warning("could not set wake up conditions: %d", ret
);
53 int wl1271_acx_sleep_auth(struct wl1271
*wl
, u8 sleep_auth
)
55 struct acx_sleep_auth
*auth
;
58 wl1271_debug(DEBUG_ACX
, "acx sleep auth %d", sleep_auth
);
60 auth
= kzalloc(sizeof(*auth
), GFP_KERNEL
);
66 auth
->sleep_auth
= sleep_auth
;
68 ret
= wl1271_cmd_configure(wl
, ACX_SLEEP_AUTH
, auth
, sizeof(*auth
));
70 wl1271_error("could not configure sleep_auth to %d: %d",
75 wl
->sleep_auth
= sleep_auth
;
80 EXPORT_SYMBOL_GPL(wl1271_acx_sleep_auth
);
82 int wl1271_acx_tx_power(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
85 struct acx_current_tx_power
*acx
;
88 wl1271_debug(DEBUG_ACX
, "acx dot11_cur_tx_pwr %d", power
);
90 if (power
< 0 || power
> 25)
93 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
99 acx
->role_id
= wlvif
->role_id
;
100 acx
->current_tx_power
= power
* 10;
102 ret
= wl1271_cmd_configure(wl
, DOT11_CUR_TX_PWR
, acx
, sizeof(*acx
));
104 wl1271_warning("configure of tx power failed: %d", ret
);
113 int wl1271_acx_feature_cfg(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
)
115 struct acx_feature_config
*feature
;
118 wl1271_debug(DEBUG_ACX
, "acx feature cfg");
120 feature
= kzalloc(sizeof(*feature
), GFP_KERNEL
);
126 /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */
127 feature
->role_id
= wlvif
->role_id
;
128 feature
->data_flow_options
= 0;
129 feature
->options
= 0;
131 ret
= wl1271_cmd_configure(wl
, ACX_FEATURE_CFG
,
132 feature
, sizeof(*feature
));
134 wl1271_error("Couldn't set HW encryption");
143 int wl1271_acx_mem_map(struct wl1271
*wl
, struct acx_header
*mem_map
,
148 wl1271_debug(DEBUG_ACX
, "acx mem map");
150 ret
= wl1271_cmd_interrogate(wl
, ACX_MEM_MAP
, mem_map
,
151 sizeof(struct acx_header
), len
);
158 int wl1271_acx_rx_msdu_life_time(struct wl1271
*wl
)
160 struct acx_rx_msdu_lifetime
*acx
;
163 wl1271_debug(DEBUG_ACX
, "acx rx msdu life time");
165 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
171 acx
->lifetime
= cpu_to_le32(wl
->conf
.rx
.rx_msdu_life_time
);
172 ret
= wl1271_cmd_configure(wl
, DOT11_RX_MSDU_LIFE_TIME
,
175 wl1271_warning("failed to set rx msdu life time: %d", ret
);
184 int wl1271_acx_slot(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
185 enum acx_slot_type slot_time
)
187 struct acx_slot
*slot
;
190 wl1271_debug(DEBUG_ACX
, "acx slot");
192 slot
= kzalloc(sizeof(*slot
), GFP_KERNEL
);
198 slot
->role_id
= wlvif
->role_id
;
199 slot
->wone_index
= STATION_WONE_INDEX
;
200 slot
->slot_time
= slot_time
;
202 ret
= wl1271_cmd_configure(wl
, ACX_SLOT
, slot
, sizeof(*slot
));
204 wl1271_warning("failed to set slot time: %d", ret
);
213 int wl1271_acx_group_address_tbl(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
214 bool enable
, void *mc_list
, u32 mc_list_len
)
216 struct acx_dot11_grp_addr_tbl
*acx
;
219 wl1271_debug(DEBUG_ACX
, "acx group address tbl");
221 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
228 acx
->role_id
= wlvif
->role_id
;
229 acx
->enabled
= enable
;
230 acx
->num_groups
= mc_list_len
;
231 memcpy(acx
->mac_table
, mc_list
, mc_list_len
* ETH_ALEN
);
233 ret
= wl1271_cmd_configure(wl
, DOT11_GROUP_ADDRESS_TBL
,
236 wl1271_warning("failed to set group addr table: %d", ret
);
245 int wl1271_acx_service_period_timeout(struct wl1271
*wl
,
246 struct wl12xx_vif
*wlvif
)
248 struct acx_rx_timeout
*rx_timeout
;
251 rx_timeout
= kzalloc(sizeof(*rx_timeout
), GFP_KERNEL
);
257 wl1271_debug(DEBUG_ACX
, "acx service period timeout");
259 rx_timeout
->role_id
= wlvif
->role_id
;
260 rx_timeout
->ps_poll_timeout
= cpu_to_le16(wl
->conf
.rx
.ps_poll_timeout
);
261 rx_timeout
->upsd_timeout
= cpu_to_le16(wl
->conf
.rx
.upsd_timeout
);
263 ret
= wl1271_cmd_configure(wl
, ACX_SERVICE_PERIOD_TIMEOUT
,
264 rx_timeout
, sizeof(*rx_timeout
));
266 wl1271_warning("failed to set service period timeout: %d",
276 int wl1271_acx_rts_threshold(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
279 struct acx_rts_threshold
*rts
;
283 * If the RTS threshold is not configured or out of range, use the
286 if (rts_threshold
> IEEE80211_MAX_RTS_THRESHOLD
)
287 rts_threshold
= wl
->conf
.rx
.rts_threshold
;
289 wl1271_debug(DEBUG_ACX
, "acx rts threshold: %d", rts_threshold
);
291 rts
= kzalloc(sizeof(*rts
), GFP_KERNEL
);
297 rts
->role_id
= wlvif
->role_id
;
298 rts
->threshold
= cpu_to_le16((u16
)rts_threshold
);
300 ret
= wl1271_cmd_configure(wl
, DOT11_RTS_THRESHOLD
, rts
, sizeof(*rts
));
302 wl1271_warning("failed to set rts threshold: %d", ret
);
311 int wl1271_acx_dco_itrim_params(struct wl1271
*wl
)
313 struct acx_dco_itrim_params
*dco
;
314 struct conf_itrim_settings
*c
= &wl
->conf
.itrim
;
317 wl1271_debug(DEBUG_ACX
, "acx dco itrim parameters");
319 dco
= kzalloc(sizeof(*dco
), GFP_KERNEL
);
325 dco
->enable
= c
->enable
;
326 dco
->timeout
= cpu_to_le32(c
->timeout
);
328 ret
= wl1271_cmd_configure(wl
, ACX_SET_DCO_ITRIM_PARAMS
,
331 wl1271_warning("failed to set dco itrim parameters: %d", ret
);
340 int wl1271_acx_beacon_filter_opt(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
343 struct acx_beacon_filter_option
*beacon_filter
= NULL
;
346 wl1271_debug(DEBUG_ACX
, "acx beacon filter opt enable=%d",
350 wl
->conf
.conn
.bcn_filt_mode
== CONF_BCN_FILT_MODE_DISABLED
)
353 beacon_filter
= kzalloc(sizeof(*beacon_filter
), GFP_KERNEL
);
354 if (!beacon_filter
) {
359 beacon_filter
->role_id
= wlvif
->role_id
;
360 beacon_filter
->enable
= enable_filter
;
363 * When set to zero, and the filter is enabled, beacons
364 * without the unicast TIM bit set are dropped.
366 beacon_filter
->max_num_beacons
= 0;
368 ret
= wl1271_cmd_configure(wl
, ACX_BEACON_FILTER_OPT
,
369 beacon_filter
, sizeof(*beacon_filter
));
371 wl1271_warning("failed to set beacon filter opt: %d", ret
);
376 kfree(beacon_filter
);
380 int wl1271_acx_beacon_filter_table(struct wl1271
*wl
,
381 struct wl12xx_vif
*wlvif
)
383 struct acx_beacon_filter_ie_table
*ie_table
;
386 bool vendor_spec
= false;
388 wl1271_debug(DEBUG_ACX
, "acx beacon filter table");
390 ie_table
= kzalloc(sizeof(*ie_table
), GFP_KERNEL
);
396 /* configure default beacon pass-through rules */
397 ie_table
->role_id
= wlvif
->role_id
;
398 ie_table
->num_ie
= 0;
399 for (i
= 0; i
< wl
->conf
.conn
.bcn_filt_ie_count
; i
++) {
400 struct conf_bcn_filt_rule
*r
= &(wl
->conf
.conn
.bcn_filt_ie
[i
]);
401 ie_table
->table
[idx
++] = r
->ie
;
402 ie_table
->table
[idx
++] = r
->rule
;
404 if (r
->ie
== WLAN_EID_VENDOR_SPECIFIC
) {
405 /* only one vendor specific ie allowed */
409 /* for vendor specific rules configure the
411 memcpy(&(ie_table
->table
[idx
]), r
->oui
,
412 CONF_BCN_IE_OUI_LEN
);
413 idx
+= CONF_BCN_IE_OUI_LEN
;
414 ie_table
->table
[idx
++] = r
->type
;
415 memcpy(&(ie_table
->table
[idx
]), r
->version
,
416 CONF_BCN_IE_VER_LEN
);
417 idx
+= CONF_BCN_IE_VER_LEN
;
424 ret
= wl1271_cmd_configure(wl
, ACX_BEACON_FILTER_TABLE
,
425 ie_table
, sizeof(*ie_table
));
427 wl1271_warning("failed to set beacon filter table: %d", ret
);
436 #define ACX_CONN_MONIT_DISABLE_VALUE 0xffffffff
438 int wl1271_acx_conn_monit_params(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
441 struct acx_conn_monit_params
*acx
;
442 u32 threshold
= ACX_CONN_MONIT_DISABLE_VALUE
;
443 u32 timeout
= ACX_CONN_MONIT_DISABLE_VALUE
;
446 wl1271_debug(DEBUG_ACX
, "acx connection monitor parameters: %s",
447 enable
? "enabled" : "disabled");
449 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
456 threshold
= wl
->conf
.conn
.synch_fail_thold
;
457 timeout
= wl
->conf
.conn
.bss_lose_timeout
;
460 acx
->role_id
= wlvif
->role_id
;
461 acx
->synch_fail_thold
= cpu_to_le32(threshold
);
462 acx
->bss_lose_timeout
= cpu_to_le32(timeout
);
464 ret
= wl1271_cmd_configure(wl
, ACX_CONN_MONIT_PARAMS
,
467 wl1271_warning("failed to set connection monitor "
468 "parameters: %d", ret
);
478 int wl1271_acx_sg_enable(struct wl1271
*wl
, bool enable
)
480 struct acx_bt_wlan_coex
*pta
;
483 wl1271_debug(DEBUG_ACX
, "acx sg enable");
485 pta
= kzalloc(sizeof(*pta
), GFP_KERNEL
);
492 pta
->enable
= wl
->conf
.sg
.state
;
494 pta
->enable
= CONF_SG_DISABLE
;
496 ret
= wl1271_cmd_configure(wl
, ACX_SG_ENABLE
, pta
, sizeof(*pta
));
498 wl1271_warning("failed to set softgemini enable: %d", ret
);
507 int wl12xx_acx_sg_cfg(struct wl1271
*wl
)
509 struct acx_bt_wlan_coex_param
*param
;
510 struct conf_sg_settings
*c
= &wl
->conf
.sg
;
513 wl1271_debug(DEBUG_ACX
, "acx sg cfg");
515 param
= kzalloc(sizeof(*param
), GFP_KERNEL
);
521 /* BT-WLAN coext parameters */
522 for (i
= 0; i
< WLCORE_CONF_SG_PARAMS_MAX
; i
++)
523 param
->params
[i
] = cpu_to_le32(c
->params
[i
]);
524 param
->param_idx
= WLCORE_CONF_SG_PARAMS_ALL
;
526 ret
= wl1271_cmd_configure(wl
, ACX_SG_CFG
, param
, sizeof(*param
));
528 wl1271_warning("failed to set sg config: %d", ret
);
537 int wl1271_acx_cca_threshold(struct wl1271
*wl
)
539 struct acx_energy_detection
*detection
;
542 wl1271_debug(DEBUG_ACX
, "acx cca threshold");
544 detection
= kzalloc(sizeof(*detection
), GFP_KERNEL
);
550 detection
->rx_cca_threshold
= cpu_to_le16(wl
->conf
.rx
.rx_cca_threshold
);
551 detection
->tx_energy_detection
= wl
->conf
.tx
.tx_energy_detection
;
553 ret
= wl1271_cmd_configure(wl
, ACX_CCA_THRESHOLD
,
554 detection
, sizeof(*detection
));
556 wl1271_warning("failed to set cca threshold: %d", ret
);
563 int wl1271_acx_bcn_dtim_options(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
)
565 struct acx_beacon_broadcast
*bb
;
568 wl1271_debug(DEBUG_ACX
, "acx bcn dtim options");
570 bb
= kzalloc(sizeof(*bb
), GFP_KERNEL
);
576 bb
->role_id
= wlvif
->role_id
;
577 bb
->beacon_rx_timeout
= cpu_to_le16(wl
->conf
.conn
.beacon_rx_timeout
);
578 bb
->broadcast_timeout
= cpu_to_le16(wl
->conf
.conn
.broadcast_timeout
);
579 bb
->rx_broadcast_in_ps
= wl
->conf
.conn
.rx_broadcast_in_ps
;
580 bb
->ps_poll_threshold
= wl
->conf
.conn
.ps_poll_threshold
;
582 ret
= wl1271_cmd_configure(wl
, ACX_BCN_DTIM_OPTIONS
, bb
, sizeof(*bb
));
584 wl1271_warning("failed to set rx config: %d", ret
);
593 int wl1271_acx_aid(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
, u16 aid
)
595 struct acx_aid
*acx_aid
;
598 wl1271_debug(DEBUG_ACX
, "acx aid");
600 acx_aid
= kzalloc(sizeof(*acx_aid
), GFP_KERNEL
);
606 acx_aid
->role_id
= wlvif
->role_id
;
607 acx_aid
->aid
= cpu_to_le16(aid
);
609 ret
= wl1271_cmd_configure(wl
, ACX_AID
, acx_aid
, sizeof(*acx_aid
));
611 wl1271_warning("failed to set aid: %d", ret
);
620 int wl1271_acx_event_mbox_mask(struct wl1271
*wl
, u32 event_mask
)
622 struct acx_event_mask
*mask
;
625 wl1271_debug(DEBUG_ACX
, "acx event mbox mask");
627 mask
= kzalloc(sizeof(*mask
), GFP_KERNEL
);
633 /* high event mask is unused */
634 mask
->high_event_mask
= cpu_to_le32(0xffffffff);
635 mask
->event_mask
= cpu_to_le32(event_mask
);
637 ret
= wl1271_cmd_configure(wl
, ACX_EVENT_MBOX_MASK
,
638 mask
, sizeof(*mask
));
640 wl1271_warning("failed to set acx_event_mbox_mask: %d", ret
);
649 int wl1271_acx_set_preamble(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
650 enum acx_preamble_type preamble
)
652 struct acx_preamble
*acx
;
655 wl1271_debug(DEBUG_ACX
, "acx_set_preamble");
657 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
663 acx
->role_id
= wlvif
->role_id
;
664 acx
->preamble
= preamble
;
666 ret
= wl1271_cmd_configure(wl
, ACX_PREAMBLE_TYPE
, acx
, sizeof(*acx
));
668 wl1271_warning("Setting of preamble failed: %d", ret
);
677 int wl1271_acx_cts_protect(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
678 enum acx_ctsprotect_type ctsprotect
)
680 struct acx_ctsprotect
*acx
;
683 wl1271_debug(DEBUG_ACX
, "acx_set_ctsprotect");
685 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
691 acx
->role_id
= wlvif
->role_id
;
692 acx
->ctsprotect
= ctsprotect
;
694 ret
= wl1271_cmd_configure(wl
, ACX_CTS_PROTECTION
, acx
, sizeof(*acx
));
696 wl1271_warning("Setting of ctsprotect failed: %d", ret
);
705 int wl1271_acx_statistics(struct wl1271
*wl
, void *stats
)
709 wl1271_debug(DEBUG_ACX
, "acx statistics");
711 ret
= wl1271_cmd_interrogate(wl
, ACX_STATISTICS
, stats
,
712 sizeof(struct acx_header
),
713 wl
->stats
.fw_stats_len
);
715 wl1271_warning("acx statistics failed: %d", ret
);
722 int wl1271_acx_sta_rate_policies(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
)
724 struct acx_rate_policy
*acx
;
725 struct conf_tx_rate_class
*c
= &wl
->conf
.tx
.sta_rc_conf
;
728 wl1271_debug(DEBUG_ACX
, "acx rate policies");
730 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
737 wl1271_debug(DEBUG_ACX
, "basic_rate: 0x%x, full_rate: 0x%x",
738 wlvif
->basic_rate
, wlvif
->rate_set
);
740 /* configure one basic rate class */
741 acx
->rate_policy_idx
= cpu_to_le32(wlvif
->sta
.basic_rate_idx
);
742 acx
->rate_policy
.enabled_rates
= cpu_to_le32(wlvif
->basic_rate
);
743 acx
->rate_policy
.short_retry_limit
= c
->short_retry_limit
;
744 acx
->rate_policy
.long_retry_limit
= c
->long_retry_limit
;
745 acx
->rate_policy
.aflags
= c
->aflags
;
747 ret
= wl1271_cmd_configure(wl
, ACX_RATE_POLICY
, acx
, sizeof(*acx
));
749 wl1271_warning("Setting of rate policies failed: %d", ret
);
753 /* configure one AP supported rate class */
754 acx
->rate_policy_idx
= cpu_to_le32(wlvif
->sta
.ap_rate_idx
);
756 /* the AP policy is HW specific */
757 acx
->rate_policy
.enabled_rates
=
758 cpu_to_le32(wlcore_hw_sta_get_ap_rate_mask(wl
, wlvif
));
759 acx
->rate_policy
.short_retry_limit
= c
->short_retry_limit
;
760 acx
->rate_policy
.long_retry_limit
= c
->long_retry_limit
;
761 acx
->rate_policy
.aflags
= c
->aflags
;
763 ret
= wl1271_cmd_configure(wl
, ACX_RATE_POLICY
, acx
, sizeof(*acx
));
765 wl1271_warning("Setting of rate policies failed: %d", ret
);
770 * configure one rate class for basic p2p operations.
771 * (p2p packets should always go out with OFDM rates, even
772 * if we are currently connected to 11b AP)
774 acx
->rate_policy_idx
= cpu_to_le32(wlvif
->sta
.p2p_rate_idx
);
775 acx
->rate_policy
.enabled_rates
=
776 cpu_to_le32(CONF_TX_RATE_MASK_BASIC_P2P
);
777 acx
->rate_policy
.short_retry_limit
= c
->short_retry_limit
;
778 acx
->rate_policy
.long_retry_limit
= c
->long_retry_limit
;
779 acx
->rate_policy
.aflags
= c
->aflags
;
781 ret
= wl1271_cmd_configure(wl
, ACX_RATE_POLICY
, acx
, sizeof(*acx
));
783 wl1271_warning("Setting of rate policies failed: %d", ret
);
792 int wl1271_acx_ap_rate_policy(struct wl1271
*wl
, struct conf_tx_rate_class
*c
,
795 struct acx_rate_policy
*acx
;
798 wl1271_debug(DEBUG_ACX
, "acx ap rate policy %d rates 0x%x",
799 idx
, c
->enabled_rates
);
801 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
807 acx
->rate_policy
.enabled_rates
= cpu_to_le32(c
->enabled_rates
);
808 acx
->rate_policy
.short_retry_limit
= c
->short_retry_limit
;
809 acx
->rate_policy
.long_retry_limit
= c
->long_retry_limit
;
810 acx
->rate_policy
.aflags
= c
->aflags
;
812 acx
->rate_policy_idx
= cpu_to_le32(idx
);
814 ret
= wl1271_cmd_configure(wl
, ACX_RATE_POLICY
, acx
, sizeof(*acx
));
816 wl1271_warning("Setting of ap rate policy failed: %d", ret
);
825 int wl1271_acx_ac_cfg(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
826 u8 ac
, u8 cw_min
, u16 cw_max
, u8 aifsn
, u16 txop
)
828 struct acx_ac_cfg
*acx
;
831 wl1271_debug(DEBUG_ACX
, "acx ac cfg %d cw_ming %d cw_max %d "
832 "aifs %d txop %d", ac
, cw_min
, cw_max
, aifsn
, txop
);
834 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
841 acx
->role_id
= wlvif
->role_id
;
843 acx
->cw_min
= cw_min
;
844 acx
->cw_max
= cpu_to_le16(cw_max
);
846 acx
->tx_op_limit
= cpu_to_le16(txop
);
848 ret
= wl1271_cmd_configure(wl
, ACX_AC_CFG
, acx
, sizeof(*acx
));
850 wl1271_warning("acx ac cfg failed: %d", ret
);
859 int wl1271_acx_tid_cfg(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
860 u8 queue_id
, u8 channel_type
,
861 u8 tsid
, u8 ps_scheme
, u8 ack_policy
,
862 u32 apsd_conf0
, u32 apsd_conf1
)
864 struct acx_tid_config
*acx
;
867 wl1271_debug(DEBUG_ACX
, "acx tid config");
869 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
876 acx
->role_id
= wlvif
->role_id
;
877 acx
->queue_id
= queue_id
;
878 acx
->channel_type
= channel_type
;
880 acx
->ps_scheme
= ps_scheme
;
881 acx
->ack_policy
= ack_policy
;
882 acx
->apsd_conf
[0] = cpu_to_le32(apsd_conf0
);
883 acx
->apsd_conf
[1] = cpu_to_le32(apsd_conf1
);
885 ret
= wl1271_cmd_configure(wl
, ACX_TID_CFG
, acx
, sizeof(*acx
));
887 wl1271_warning("Setting of tid config failed: %d", ret
);
896 int wl1271_acx_frag_threshold(struct wl1271
*wl
, u32 frag_threshold
)
898 struct acx_frag_threshold
*acx
;
902 * If the fragmentation is not configured or out of range, use the
905 if (frag_threshold
> IEEE80211_MAX_FRAG_THRESHOLD
)
906 frag_threshold
= wl
->conf
.tx
.frag_threshold
;
908 wl1271_debug(DEBUG_ACX
, "acx frag threshold: %d", frag_threshold
);
910 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
917 acx
->frag_threshold
= cpu_to_le16((u16
)frag_threshold
);
918 ret
= wl1271_cmd_configure(wl
, ACX_FRAG_CFG
, acx
, sizeof(*acx
));
920 wl1271_warning("Setting of frag threshold failed: %d", ret
);
929 int wl1271_acx_tx_config_options(struct wl1271
*wl
)
931 struct acx_tx_config_options
*acx
;
934 wl1271_debug(DEBUG_ACX
, "acx tx config options");
936 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
943 acx
->tx_compl_timeout
= cpu_to_le16(wl
->conf
.tx
.tx_compl_timeout
);
944 acx
->tx_compl_threshold
= cpu_to_le16(wl
->conf
.tx
.tx_compl_threshold
);
945 ret
= wl1271_cmd_configure(wl
, ACX_TX_CONFIG_OPT
, acx
, sizeof(*acx
));
947 wl1271_warning("Setting of tx options failed: %d", ret
);
956 int wl12xx_acx_mem_cfg(struct wl1271
*wl
)
958 struct wl12xx_acx_config_memory
*mem_conf
;
959 struct conf_memory_settings
*mem
;
962 wl1271_debug(DEBUG_ACX
, "wl1271 mem cfg");
964 mem_conf
= kzalloc(sizeof(*mem_conf
), GFP_KERNEL
);
973 mem_conf
->num_stations
= mem
->num_stations
;
974 mem_conf
->rx_mem_block_num
= mem
->rx_block_num
;
975 mem_conf
->tx_min_mem_block_num
= mem
->tx_min_block_num
;
976 mem_conf
->num_ssid_profiles
= mem
->ssid_profiles
;
977 mem_conf
->total_tx_descriptors
= cpu_to_le32(wl
->num_tx_desc
);
978 mem_conf
->dyn_mem_enable
= mem
->dynamic_memory
;
979 mem_conf
->tx_free_req
= mem
->min_req_tx_blocks
;
980 mem_conf
->rx_free_req
= mem
->min_req_rx_blocks
;
981 mem_conf
->tx_min
= mem
->tx_min
;
982 mem_conf
->fwlog_blocks
= wl
->conf
.fwlog
.mem_blocks
;
984 ret
= wl1271_cmd_configure(wl
, ACX_MEM_CFG
, mem_conf
,
987 wl1271_warning("wl1271 mem config failed: %d", ret
);
995 EXPORT_SYMBOL_GPL(wl12xx_acx_mem_cfg
);
997 int wl1271_acx_init_mem_config(struct wl1271
*wl
)
1001 wl
->target_mem_map
= kzalloc(sizeof(struct wl1271_acx_mem_map
),
1003 if (!wl
->target_mem_map
) {
1004 wl1271_error("couldn't allocate target memory map");
1008 /* we now ask for the firmware built memory map */
1009 ret
= wl1271_acx_mem_map(wl
, (void *)wl
->target_mem_map
,
1010 sizeof(struct wl1271_acx_mem_map
));
1012 wl1271_error("couldn't retrieve firmware memory map");
1013 kfree(wl
->target_mem_map
);
1014 wl
->target_mem_map
= NULL
;
1018 /* initialize TX block book keeping */
1019 wl
->tx_blocks_available
=
1020 le32_to_cpu(wl
->target_mem_map
->num_tx_mem_blocks
);
1021 wl1271_debug(DEBUG_TX
, "available tx blocks: %d",
1022 wl
->tx_blocks_available
);
1026 EXPORT_SYMBOL_GPL(wl1271_acx_init_mem_config
);
1028 int wl1271_acx_init_rx_interrupt(struct wl1271
*wl
)
1030 struct wl1271_acx_rx_config_opt
*rx_conf
;
1033 wl1271_debug(DEBUG_ACX
, "wl1271 rx interrupt config");
1035 rx_conf
= kzalloc(sizeof(*rx_conf
), GFP_KERNEL
);
1041 rx_conf
->threshold
= cpu_to_le16(wl
->conf
.rx
.irq_pkt_threshold
);
1042 rx_conf
->timeout
= cpu_to_le16(wl
->conf
.rx
.irq_timeout
);
1043 rx_conf
->mblk_threshold
= cpu_to_le16(wl
->conf
.rx
.irq_blk_threshold
);
1044 rx_conf
->queue_type
= wl
->conf
.rx
.queue_type
;
1046 ret
= wl1271_cmd_configure(wl
, ACX_RX_CONFIG_OPT
, rx_conf
,
1049 wl1271_warning("wl1271 rx config opt failed: %d", ret
);
1058 int wl1271_acx_bet_enable(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
1061 struct wl1271_acx_bet_enable
*acx
= NULL
;
1064 wl1271_debug(DEBUG_ACX
, "acx bet enable");
1066 if (enable
&& wl
->conf
.conn
.bet_enable
== CONF_BET_MODE_DISABLE
)
1069 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1075 acx
->role_id
= wlvif
->role_id
;
1076 acx
->enable
= enable
? CONF_BET_MODE_ENABLE
: CONF_BET_MODE_DISABLE
;
1077 acx
->max_consecutive
= wl
->conf
.conn
.bet_max_consecutive
;
1079 ret
= wl1271_cmd_configure(wl
, ACX_BET_ENABLE
, acx
, sizeof(*acx
));
1081 wl1271_warning("acx bet enable failed: %d", ret
);
1090 int wl1271_acx_arp_ip_filter(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
1091 u8 enable
, __be32 address
)
1093 struct wl1271_acx_arp_filter
*acx
;
1096 wl1271_debug(DEBUG_ACX
, "acx arp ip filter, enable: %d", enable
);
1098 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1104 acx
->role_id
= wlvif
->role_id
;
1105 acx
->version
= ACX_IPV4_VERSION
;
1106 acx
->enable
= enable
;
1109 memcpy(acx
->address
, &address
, ACX_IPV4_ADDR_SIZE
);
1111 ret
= wl1271_cmd_configure(wl
, ACX_ARP_IP_FILTER
,
1114 wl1271_warning("failed to set arp ip filter: %d", ret
);
1123 int wl1271_acx_pm_config(struct wl1271
*wl
)
1125 struct wl1271_acx_pm_config
*acx
= NULL
;
1126 struct conf_pm_config_settings
*c
= &wl
->conf
.pm_config
;
1129 wl1271_debug(DEBUG_ACX
, "acx pm config");
1131 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1137 acx
->host_clk_settling_time
= cpu_to_le32(c
->host_clk_settling_time
);
1138 acx
->host_fast_wakeup_support
= c
->host_fast_wakeup_support
;
1140 ret
= wl1271_cmd_configure(wl
, ACX_PM_CONFIG
, acx
, sizeof(*acx
));
1142 wl1271_warning("acx pm config failed: %d", ret
);
1150 EXPORT_SYMBOL_GPL(wl1271_acx_pm_config
);
1152 int wl1271_acx_keep_alive_mode(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
1155 struct wl1271_acx_keep_alive_mode
*acx
= NULL
;
1158 wl1271_debug(DEBUG_ACX
, "acx keep alive mode: %d", enable
);
1160 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1166 acx
->role_id
= wlvif
->role_id
;
1167 acx
->enabled
= enable
;
1169 ret
= wl1271_cmd_configure(wl
, ACX_KEEP_ALIVE_MODE
, acx
, sizeof(*acx
));
1171 wl1271_warning("acx keep alive mode failed: %d", ret
);
1180 int wl1271_acx_keep_alive_config(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
1181 u8 index
, u8 tpl_valid
)
1183 struct wl1271_acx_keep_alive_config
*acx
= NULL
;
1186 wl1271_debug(DEBUG_ACX
, "acx keep alive config");
1188 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1194 acx
->role_id
= wlvif
->role_id
;
1195 acx
->period
= cpu_to_le32(wl
->conf
.conn
.keep_alive_interval
);
1197 acx
->tpl_validation
= tpl_valid
;
1198 acx
->trigger
= ACX_KEEP_ALIVE_NO_TX
;
1200 ret
= wl1271_cmd_configure(wl
, ACX_SET_KEEP_ALIVE_CONFIG
,
1203 wl1271_warning("acx keep alive config failed: %d", ret
);
1212 int wl1271_acx_rssi_snr_trigger(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
1213 bool enable
, s16 thold
, u8 hyst
)
1215 struct wl1271_acx_rssi_snr_trigger
*acx
= NULL
;
1218 wl1271_debug(DEBUG_ACX
, "acx rssi snr trigger");
1220 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1226 wlvif
->last_rssi_event
= -1;
1228 acx
->role_id
= wlvif
->role_id
;
1229 acx
->pacing
= cpu_to_le16(wl
->conf
.roam_trigger
.trigger_pacing
);
1230 acx
->metric
= WL1271_ACX_TRIG_METRIC_RSSI_BEACON
;
1231 acx
->type
= WL1271_ACX_TRIG_TYPE_EDGE
;
1233 acx
->enable
= WL1271_ACX_TRIG_ENABLE
;
1235 acx
->enable
= WL1271_ACX_TRIG_DISABLE
;
1237 acx
->index
= WL1271_ACX_TRIG_IDX_RSSI
;
1238 acx
->dir
= WL1271_ACX_TRIG_DIR_BIDIR
;
1239 acx
->threshold
= cpu_to_le16(thold
);
1240 acx
->hysteresis
= hyst
;
1242 ret
= wl1271_cmd_configure(wl
, ACX_RSSI_SNR_TRIGGER
, acx
, sizeof(*acx
));
1244 wl1271_warning("acx rssi snr trigger setting failed: %d", ret
);
1253 int wl1271_acx_rssi_snr_avg_weights(struct wl1271
*wl
,
1254 struct wl12xx_vif
*wlvif
)
1256 struct wl1271_acx_rssi_snr_avg_weights
*acx
= NULL
;
1257 struct conf_roam_trigger_settings
*c
= &wl
->conf
.roam_trigger
;
1260 wl1271_debug(DEBUG_ACX
, "acx rssi snr avg weights");
1262 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1268 acx
->role_id
= wlvif
->role_id
;
1269 acx
->rssi_beacon
= c
->avg_weight_rssi_beacon
;
1270 acx
->rssi_data
= c
->avg_weight_rssi_data
;
1271 acx
->snr_beacon
= c
->avg_weight_snr_beacon
;
1272 acx
->snr_data
= c
->avg_weight_snr_data
;
1274 ret
= wl1271_cmd_configure(wl
, ACX_RSSI_SNR_WEIGHTS
, acx
, sizeof(*acx
));
1276 wl1271_warning("acx rssi snr trigger weights failed: %d", ret
);
1285 int wl1271_acx_set_ht_capabilities(struct wl1271
*wl
,
1286 struct ieee80211_sta_ht_cap
*ht_cap
,
1287 bool allow_ht_operation
, u8 hlid
)
1289 struct wl1271_acx_ht_capabilities
*acx
;
1291 u32 ht_capabilites
= 0;
1293 wl1271_debug(DEBUG_ACX
, "acx ht capabilities setting "
1294 "sta supp: %d sta cap: %d", ht_cap
->ht_supported
,
1297 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1303 if (allow_ht_operation
&& ht_cap
->ht_supported
) {
1304 /* no need to translate capabilities - use the spec values */
1305 ht_capabilites
= ht_cap
->cap
;
1308 * this bit is not employed by the spec but only by FW to
1309 * indicate peer HT support
1311 ht_capabilites
|= WL12XX_HT_CAP_HT_OPERATION
;
1313 /* get data from A-MPDU parameters field */
1314 acx
->ampdu_max_length
= ht_cap
->ampdu_factor
;
1315 acx
->ampdu_min_spacing
= ht_cap
->ampdu_density
;
1319 acx
->ht_capabilites
= cpu_to_le32(ht_capabilites
);
1321 ret
= wl1271_cmd_configure(wl
, ACX_PEER_HT_CAP
, acx
, sizeof(*acx
));
1323 wl1271_warning("acx ht capabilities setting failed: %d", ret
);
1331 EXPORT_SYMBOL_GPL(wl1271_acx_set_ht_capabilities
);
1334 int wl1271_acx_set_ht_information(struct wl1271
*wl
,
1335 struct wl12xx_vif
*wlvif
,
1336 u16 ht_operation_mode
)
1338 struct wl1271_acx_ht_information
*acx
;
1341 wl1271_debug(DEBUG_ACX
, "acx ht information setting");
1343 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1349 acx
->role_id
= wlvif
->role_id
;
1350 acx
->ht_protection
=
1351 (u8
)(ht_operation_mode
& IEEE80211_HT_OP_MODE_PROTECTION
);
1353 acx
->gf_protection
=
1354 !!(ht_operation_mode
& IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT
);
1355 acx
->ht_tx_burst_limit
= 0;
1356 acx
->dual_cts_protection
= 0;
1358 ret
= wl1271_cmd_configure(wl
, ACX_HT_BSS_OPERATION
, acx
, sizeof(*acx
));
1361 wl1271_warning("acx ht information setting failed: %d", ret
);
1370 /* Configure BA session initiator/receiver parameters setting in the FW. */
1371 int wl12xx_acx_set_ba_initiator_policy(struct wl1271
*wl
,
1372 struct wl12xx_vif
*wlvif
)
1374 struct wl1271_acx_ba_initiator_policy
*acx
;
1377 wl1271_debug(DEBUG_ACX
, "acx ba initiator policy");
1379 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1385 /* set for the current role */
1386 acx
->role_id
= wlvif
->role_id
;
1387 acx
->tid_bitmap
= wl
->conf
.ht
.tx_ba_tid_bitmap
;
1388 acx
->win_size
= wl
->conf
.ht
.tx_ba_win_size
;
1389 acx
->inactivity_timeout
= wl
->conf
.ht
.inactivity_timeout
;
1391 ret
= wl1271_cmd_configure(wl
,
1392 ACX_BA_SESSION_INIT_POLICY
,
1396 wl1271_warning("acx ba initiator policy failed: %d", ret
);
1405 /* setup BA session receiver setting in the FW. */
1406 int wl12xx_acx_set_ba_receiver_session(struct wl1271
*wl
, u8 tid_index
,
1407 u16 ssn
, bool enable
, u8 peer_hlid
,
1410 struct wl1271_acx_ba_receiver_setup
*acx
;
1413 wl1271_debug(DEBUG_ACX
, "acx ba receiver session setting");
1415 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1421 acx
->hlid
= peer_hlid
;
1422 acx
->tid
= tid_index
;
1423 acx
->enable
= enable
;
1424 acx
->win_size
= win_size
;
1427 ret
= wlcore_cmd_configure_failsafe(wl
, ACX_BA_SESSION_RX_SETUP
, acx
,
1429 BIT(CMD_STATUS_NO_RX_BA_SESSION
));
1431 wl1271_warning("acx ba receiver session failed: %d", ret
);
1435 /* sometimes we can't start the session */
1436 if (ret
== CMD_STATUS_NO_RX_BA_SESSION
) {
1437 wl1271_warning("no fw rx ba on tid %d", tid_index
);
1448 int wl12xx_acx_tsf_info(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
1451 struct wl12xx_acx_fw_tsf_information
*tsf_info
;
1454 tsf_info
= kzalloc(sizeof(*tsf_info
), GFP_KERNEL
);
1460 tsf_info
->role_id
= wlvif
->role_id
;
1462 ret
= wl1271_cmd_interrogate(wl
, ACX_TSF_INFO
, tsf_info
,
1463 sizeof(struct acx_header
), sizeof(*tsf_info
));
1465 wl1271_warning("acx tsf info interrogate failed");
1469 *mactime
= le32_to_cpu(tsf_info
->current_tsf_low
) |
1470 ((u64
) le32_to_cpu(tsf_info
->current_tsf_high
) << 32);
1477 int wl1271_acx_ps_rx_streaming(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
1480 struct wl1271_acx_ps_rx_streaming
*rx_streaming
;
1481 u32 conf_queues
, enable_queues
;
1484 wl1271_debug(DEBUG_ACX
, "acx ps rx streaming");
1486 rx_streaming
= kzalloc(sizeof(*rx_streaming
), GFP_KERNEL
);
1487 if (!rx_streaming
) {
1492 conf_queues
= wl
->conf
.rx_streaming
.queues
;
1494 enable_queues
= conf_queues
;
1498 for (i
= 0; i
< 8; i
++) {
1500 * Skip non-changed queues, to avoid redundant acxs.
1501 * this check assumes conf.rx_streaming.queues can't
1502 * be changed while rx_streaming is enabled.
1504 if (!(conf_queues
& BIT(i
)))
1507 rx_streaming
->role_id
= wlvif
->role_id
;
1508 rx_streaming
->tid
= i
;
1509 rx_streaming
->enable
= enable_queues
& BIT(i
);
1510 rx_streaming
->period
= wl
->conf
.rx_streaming
.interval
;
1511 rx_streaming
->timeout
= wl
->conf
.rx_streaming
.interval
;
1513 ret
= wl1271_cmd_configure(wl
, ACX_PS_RX_STREAMING
,
1515 sizeof(*rx_streaming
));
1517 wl1271_warning("acx ps rx streaming failed: %d", ret
);
1522 kfree(rx_streaming
);
1526 int wl1271_acx_ap_max_tx_retry(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
)
1528 struct wl1271_acx_ap_max_tx_retry
*acx
= NULL
;
1531 wl1271_debug(DEBUG_ACX
, "acx ap max tx retry");
1533 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1537 acx
->role_id
= wlvif
->role_id
;
1538 acx
->max_tx_retry
= cpu_to_le16(wl
->conf
.tx
.max_tx_retries
);
1540 ret
= wl1271_cmd_configure(wl
, ACX_MAX_TX_FAILURE
, acx
, sizeof(*acx
));
1542 wl1271_warning("acx ap max tx retry failed: %d", ret
);
1551 int wl12xx_acx_config_ps(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
)
1553 struct wl1271_acx_config_ps
*config_ps
;
1556 wl1271_debug(DEBUG_ACX
, "acx config ps");
1558 config_ps
= kzalloc(sizeof(*config_ps
), GFP_KERNEL
);
1564 config_ps
->exit_retries
= wl
->conf
.conn
.psm_exit_retries
;
1565 config_ps
->enter_retries
= wl
->conf
.conn
.psm_entry_retries
;
1566 config_ps
->null_data_rate
= cpu_to_le32(wlvif
->basic_rate
);
1568 ret
= wl1271_cmd_configure(wl
, ACX_CONFIG_PS
, config_ps
,
1569 sizeof(*config_ps
));
1572 wl1271_warning("acx config ps failed: %d", ret
);
1581 int wl1271_acx_set_inconnection_sta(struct wl1271
*wl
,
1582 struct wl12xx_vif
*wlvif
, u8
*addr
)
1584 struct wl1271_acx_inconnection_sta
*acx
= NULL
;
1587 wl1271_debug(DEBUG_ACX
, "acx set inconnaction sta %pM", addr
);
1589 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1593 memcpy(acx
->addr
, addr
, ETH_ALEN
);
1594 acx
->role_id
= wlvif
->role_id
;
1596 ret
= wl1271_cmd_configure(wl
, ACX_UPDATE_INCONNECTION_STA_LIST
,
1599 wl1271_warning("acx set inconnaction sta failed: %d", ret
);
1608 int wl1271_acx_fm_coex(struct wl1271
*wl
)
1610 struct wl1271_acx_fm_coex
*acx
;
1613 wl1271_debug(DEBUG_ACX
, "acx fm coex setting");
1615 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1621 acx
->enable
= wl
->conf
.fm_coex
.enable
;
1622 acx
->swallow_period
= wl
->conf
.fm_coex
.swallow_period
;
1623 acx
->n_divider_fref_set_1
= wl
->conf
.fm_coex
.n_divider_fref_set_1
;
1624 acx
->n_divider_fref_set_2
= wl
->conf
.fm_coex
.n_divider_fref_set_2
;
1625 acx
->m_divider_fref_set_1
=
1626 cpu_to_le16(wl
->conf
.fm_coex
.m_divider_fref_set_1
);
1627 acx
->m_divider_fref_set_2
=
1628 cpu_to_le16(wl
->conf
.fm_coex
.m_divider_fref_set_2
);
1629 acx
->coex_pll_stabilization_time
=
1630 cpu_to_le32(wl
->conf
.fm_coex
.coex_pll_stabilization_time
);
1631 acx
->ldo_stabilization_time
=
1632 cpu_to_le16(wl
->conf
.fm_coex
.ldo_stabilization_time
);
1633 acx
->fm_disturbed_band_margin
=
1634 wl
->conf
.fm_coex
.fm_disturbed_band_margin
;
1635 acx
->swallow_clk_diff
= wl
->conf
.fm_coex
.swallow_clk_diff
;
1637 ret
= wl1271_cmd_configure(wl
, ACX_FM_COEX_CFG
, acx
, sizeof(*acx
));
1639 wl1271_warning("acx fm coex setting failed: %d", ret
);
1648 int wl12xx_acx_set_rate_mgmt_params(struct wl1271
*wl
)
1650 struct wl12xx_acx_set_rate_mgmt_params
*acx
= NULL
;
1651 struct conf_rate_policy_settings
*conf
= &wl
->conf
.rate
;
1654 wl1271_debug(DEBUG_ACX
, "acx set rate mgmt params");
1656 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1660 acx
->index
= ACX_RATE_MGMT_ALL_PARAMS
;
1661 acx
->rate_retry_score
= cpu_to_le16(conf
->rate_retry_score
);
1662 acx
->per_add
= cpu_to_le16(conf
->per_add
);
1663 acx
->per_th1
= cpu_to_le16(conf
->per_th1
);
1664 acx
->per_th2
= cpu_to_le16(conf
->per_th2
);
1665 acx
->max_per
= cpu_to_le16(conf
->max_per
);
1666 acx
->inverse_curiosity_factor
= conf
->inverse_curiosity_factor
;
1667 acx
->tx_fail_low_th
= conf
->tx_fail_low_th
;
1668 acx
->tx_fail_high_th
= conf
->tx_fail_high_th
;
1669 acx
->per_alpha_shift
= conf
->per_alpha_shift
;
1670 acx
->per_add_shift
= conf
->per_add_shift
;
1671 acx
->per_beta1_shift
= conf
->per_beta1_shift
;
1672 acx
->per_beta2_shift
= conf
->per_beta2_shift
;
1673 acx
->rate_check_up
= conf
->rate_check_up
;
1674 acx
->rate_check_down
= conf
->rate_check_down
;
1675 memcpy(acx
->rate_retry_policy
, conf
->rate_retry_policy
,
1676 sizeof(acx
->rate_retry_policy
));
1678 ret
= wl1271_cmd_configure(wl
, ACX_SET_RATE_MGMT_PARAMS
,
1681 wl1271_warning("acx set rate mgmt params failed: %d", ret
);
1690 int wl12xx_acx_config_hangover(struct wl1271
*wl
)
1692 struct wl12xx_acx_config_hangover
*acx
;
1693 struct conf_hangover_settings
*conf
= &wl
->conf
.hangover
;
1696 wl1271_debug(DEBUG_ACX
, "acx config hangover");
1698 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1704 acx
->recover_time
= cpu_to_le32(conf
->recover_time
);
1705 acx
->hangover_period
= conf
->hangover_period
;
1706 acx
->dynamic_mode
= conf
->dynamic_mode
;
1707 acx
->early_termination_mode
= conf
->early_termination_mode
;
1708 acx
->max_period
= conf
->max_period
;
1709 acx
->min_period
= conf
->min_period
;
1710 acx
->increase_delta
= conf
->increase_delta
;
1711 acx
->decrease_delta
= conf
->decrease_delta
;
1712 acx
->quiet_time
= conf
->quiet_time
;
1713 acx
->increase_time
= conf
->increase_time
;
1714 acx
->window_size
= conf
->window_size
;
1716 ret
= wl1271_cmd_configure(wl
, ACX_CONFIG_HANGOVER
, acx
,
1720 wl1271_warning("acx config hangover failed: %d", ret
);
1730 int wlcore_acx_average_rssi(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
,
1733 struct acx_roaming_stats
*acx
;
1736 wl1271_debug(DEBUG_ACX
, "acx roaming statistics");
1738 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1744 acx
->role_id
= wlvif
->role_id
;
1745 ret
= wl1271_cmd_interrogate(wl
, ACX_ROAMING_STATISTICS_TBL
,
1746 acx
, sizeof(*acx
), sizeof(*acx
));
1748 wl1271_warning("acx roaming statistics failed: %d", ret
);
1753 *avg_rssi
= acx
->rssi_beacon
;
1760 /* Set the global behaviour of RX filters - On/Off + default action */
1761 int wl1271_acx_default_rx_filter_enable(struct wl1271
*wl
, bool enable
,
1762 enum rx_filter_action action
)
1764 struct acx_default_rx_filter
*acx
;
1767 wl1271_debug(DEBUG_ACX
, "acx default rx filter en: %d act: %d",
1770 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1774 acx
->enable
= enable
;
1775 acx
->default_action
= action
;
1777 ret
= wl1271_cmd_configure(wl
, ACX_ENABLE_RX_DATA_FILTER
, acx
,
1780 wl1271_warning("acx default rx filter enable failed: %d", ret
);
1789 /* Configure or disable a specific RX filter pattern */
1790 int wl1271_acx_set_rx_filter(struct wl1271
*wl
, u8 index
, bool enable
,
1791 struct wl12xx_rx_filter
*filter
)
1793 struct acx_rx_filter_cfg
*acx
;
1794 int fields_size
= 0;
1798 WARN_ON(enable
&& !filter
);
1799 WARN_ON(index
>= WL1271_MAX_RX_FILTERS
);
1801 wl1271_debug(DEBUG_ACX
,
1802 "acx set rx filter idx: %d enable: %d filter: %p",
1803 index
, enable
, filter
);
1806 fields_size
= wl1271_rx_filter_get_fields_size(filter
);
1808 wl1271_debug(DEBUG_ACX
, "act: %d num_fields: %d field_size: %d",
1809 filter
->action
, filter
->num_fields
, fields_size
);
1812 acx_size
= ALIGN(sizeof(*acx
) + fields_size
, 4);
1813 acx
= kzalloc(acx_size
, GFP_KERNEL
);
1818 acx
->enable
= enable
;
1822 acx
->num_fields
= filter
->num_fields
;
1823 acx
->action
= filter
->action
;
1824 wl1271_rx_filter_flatten_fields(filter
, acx
->fields
);
1827 wl1271_dump(DEBUG_ACX
, "RX_FILTER: ", acx
, acx_size
);
1829 ret
= wl1271_cmd_configure(wl
, ACX_SET_RX_DATA_FILTER
, acx
, acx_size
);
1831 wl1271_warning("setting rx filter failed: %d", ret
);
1839 #endif /* CONFIG_PM */