int wl1271_acx_service_period_timeout(struct wl1271 *wl) { struct acx_rx_timeout *rx_timeout; int ret; rx_timeout = kzalloc(sizeof(*rx_timeout), GFP_KERNEL); if (!rx_timeout) { ret = -ENOMEM; goto out; } wl1271_debug(DEBUG_ACX, "acx service period timeout"); rx_timeout->ps_poll_timeout = cpu_to_le16(wl->conf.rx.ps_poll_timeout); rx_timeout->upsd_timeout = cpu_to_le16(wl->conf.rx.upsd_timeout); ret = wl1271_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT, rx_timeout, sizeof(*rx_timeout)); if (ret < 0) { wl1271_warning("failed to set service period timeout: %d", ret); goto out; } out: kfree(rx_timeout); return ret; }
int wl1271_acx_keep_alive_config(struct wl1271 *wl, u8 index, u8 tpl_valid) { struct wl1271_acx_keep_alive_config *acx = NULL; int ret = 0; wl1271_debug(DEBUG_ACX, "acx keep alive config"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->role_id = wl->role_id; acx->period = cpu_to_le32(wl->conf.conn.keep_alive_interval); acx->index = index; acx->tpl_validation = tpl_valid; acx->trigger = ACX_KEEP_ALIVE_NO_TX; ret = wl1271_cmd_configure(wl, ACX_SET_KEEP_ALIVE_CONFIG, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("acx keep alive config failed: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_set_ht_information(struct wl1271 *wl, u16 ht_operation_mode) { struct wl1271_acx_ht_information *acx; int ret = 0; wl1271_debug(DEBUG_ACX, "acx ht information setting"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->role_id = wl->role_id; acx->ht_protection = (u8)(ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION); acx->rifs_mode = 0; acx->gf_protection = !!(ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); acx->ht_tx_burst_limit = 0; acx->dual_cts_protection = 0; ret = wl1271_cmd_configure(wl, ACX_HT_BSS_OPERATION, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("acx ht information setting failed: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_arp_ip_filter(struct wl1271 *wl, u8 enable, __be32 address) { struct wl1271_acx_arp_filter *acx; int ret; wl1271_debug(DEBUG_ACX, "acx arp ip filter, enable: %d", enable); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->role_id = wl->role_id; acx->version = ACX_IPV4_VERSION; acx->enable = enable; if (enable) memcpy(acx->address, &address, ACX_IPV4_ADDR_SIZE); ret = wl1271_cmd_configure(wl, ACX_ARP_IP_FILTER, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("failed to set arp ip filter: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_pm_config(struct wl1271 *wl) { struct wl1271_acx_pm_config *acx = NULL; struct conf_pm_config_settings *c = &wl->conf.pm_config; int ret = 0; wl1271_debug(DEBUG_ACX, "acx pm config"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->host_clk_settling_time = cpu_to_le32(c->host_clk_settling_time); acx->host_fast_wakeup_support = c->host_fast_wakeup_support; ret = wl1271_cmd_configure(wl, ACX_PM_CONFIG, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("acx pm config failed: %d", ret); goto out; } out: kfree(acx); return ret; }
static int wl1271_tm_cmd_configure(struct wl1271 *wl, struct nlattr *tb[]) { int buf_len, ret; void *buf; u8 ie_id; wl1271_debug(DEBUG_TESTMODE, "testmode cmd configure"); if (!tb[WL1271_TM_ATTR_DATA]) return -EINVAL; if (!tb[WL1271_TM_ATTR_IE_ID]) return -EINVAL; ie_id = nla_get_u8(tb[WL1271_TM_ATTR_IE_ID]); buf = nla_data(tb[WL1271_TM_ATTR_DATA]); buf_len = nla_len(tb[WL1271_TM_ATTR_DATA]); if (buf_len > sizeof(struct wl1271_command)) return -EMSGSIZE; mutex_lock(&wl->mutex); ret = wl1271_cmd_configure(wl, ie_id, buf, buf_len); mutex_unlock(&wl->mutex); if (ret < 0) { wl1271_warning("testmode cmd configure failed: %d", ret); return ret; } return 0; }
int wl1271_acx_init_rx_interrupt(struct wl1271 *wl) { struct wl1271_acx_rx_config_opt *rx_conf; int ret; wl1271_debug(DEBUG_ACX, "wl1271 rx interrupt config"); rx_conf = kzalloc(sizeof(*rx_conf), GFP_KERNEL); if (!rx_conf) { ret = -ENOMEM; goto out; } rx_conf->threshold = cpu_to_le16(wl->conf.rx.irq_pkt_threshold); rx_conf->timeout = cpu_to_le16(wl->conf.rx.irq_timeout); rx_conf->mblk_threshold = cpu_to_le16(wl->conf.rx.irq_blk_threshold); rx_conf->queue_type = wl->conf.rx.queue_type; ret = wl1271_cmd_configure(wl, ACX_RX_CONFIG_OPT, rx_conf, sizeof(*rx_conf)); if (ret < 0) { wl1271_warning("wl1271 rx config opt failed: %d", ret); goto out; } out: kfree(rx_conf); return ret; }
int wl1271_acx_cca_threshold(struct wl1271 *wl) { struct acx_energy_detection *detection; int ret; wl1271_debug(DEBUG_ACX, "acx cca threshold"); detection = kzalloc(sizeof(*detection), GFP_KERNEL); if (!detection) { ret = -ENOMEM; goto out; } detection->rx_cca_threshold = cpu_to_le16(wl->conf.rx.rx_cca_threshold); detection->tx_energy_detection = wl->conf.tx.tx_energy_detection; ret = wl1271_cmd_configure(wl, ACX_CCA_THRESHOLD, detection, sizeof(*detection)); if (ret < 0) { wl1271_warning("failed to set cca threshold: %d", ret); return ret; } out: kfree(detection); return ret; }
int wl1271_acx_bcn_dtim_options(struct wl1271 *wl) { struct acx_beacon_broadcast *bb; int ret; wl1271_debug(DEBUG_ACX, "acx bcn dtim options"); bb = kzalloc(sizeof(*bb), GFP_KERNEL); if (!bb) { ret = -ENOMEM; goto out; } bb->beacon_rx_timeout = cpu_to_le16(wl->conf.conn.beacon_rx_timeout); bb->broadcast_timeout = cpu_to_le16(wl->conf.conn.broadcast_timeout); bb->rx_broadcast_in_ps = wl->conf.conn.rx_broadcast_in_ps; bb->ps_poll_threshold = wl->conf.conn.ps_poll_threshold; ret = wl1271_cmd_configure(wl, ACX_BCN_DTIM_OPTIONS, bb, sizeof(*bb)); if (ret < 0) { wl1271_warning("failed to set rx config: %d", ret); goto out; } out: kfree(bb); return ret; }
int wl1271_acx_conn_monit_params(struct wl1271 *wl) { struct acx_conn_monit_params *acx; int ret; wl1271_debug(DEBUG_ACX, "acx connection monitor parameters"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->synch_fail_thold = cpu_to_le32(wl->conf.conn.synch_fail_thold); acx->bss_lose_timeout = cpu_to_le32(wl->conf.conn.bss_lose_timeout); ret = wl1271_cmd_configure(wl, ACX_CONN_MONIT_PARAMS, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("failed to set connection monitor " "parameters: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_sg_enable(struct wl1271 *wl) { struct acx_bt_wlan_coex *pta; int ret; wl1271_debug(DEBUG_ACX, "acx sg enable"); pta = kzalloc(sizeof(*pta), GFP_KERNEL); if (!pta) { ret = -ENOMEM; goto out; } pta->enable = SG_ENABLE; ret = wl1271_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta)); if (ret < 0) { wl1271_warning("failed to set softgemini enable: %d", ret); goto out; } out: kfree(pta); return ret; }
int wl1271_acx_dco_itrim_params(struct wl1271 *wl) { struct acx_dco_itrim_params *dco; struct conf_itrim_settings *c = &wl->conf.itrim; int ret; wl1271_debug(DEBUG_ACX, "acx dco itrim parameters"); dco = kzalloc(sizeof(*dco), GFP_KERNEL); if (!dco) { ret = -ENOMEM; goto out; } dco->enable = c->enable; dco->timeout = cpu_to_le32(c->timeout); ret = wl1271_cmd_configure(wl, ACX_SET_DCO_ITRIM_PARAMS, dco, sizeof(*dco)); if (ret < 0) { wl1271_warning("failed to set dco itrim parameters: %d", ret); goto out; } out: kfree(dco); return ret; }
int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold) { struct acx_rts_threshold *rts; int ret; wl1271_debug(DEBUG_ACX, "acx rts threshold"); rts = kzalloc(sizeof(*rts), GFP_KERNEL); if (!rts) { ret = -ENOMEM; goto out; } rts->threshold = cpu_to_le16(rts_threshold); ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts)); if (ret < 0) { wl1271_warning("failed to set rts threshold: %d", ret); goto out; } out: kfree(rts); return ret; }
int wl1271_acx_wake_up_conditions(struct wl1271 *wl) { struct acx_wake_up_condition *wake_up; int ret; wl1271_debug(DEBUG_ACX, "acx wake up conditions"); wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL); if (!wake_up) { ret = -ENOMEM; goto out; } wake_up->wake_up_event = wl->conf.conn.wake_up_event; wake_up->listen_interval = wl->conf.conn.listen_interval; ret = wl1271_cmd_configure(wl, ACX_WAKE_UP_CONDITIONS, wake_up, sizeof(*wake_up)); if (ret < 0) { wl1271_warning("could not set wake up conditions: %d", ret); goto out; } out: kfree(wake_up); return ret; }
int wl1271_acx_tx_config_options(struct wl1271 *wl) { struct acx_tx_config_options *acx; int ret = 0; wl1271_debug(DEBUG_ACX, "acx tx config options"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->tx_compl_timeout = cpu_to_le16(wl->conf.tx.tx_compl_timeout); acx->tx_compl_threshold = cpu_to_le16(wl->conf.tx.tx_compl_threshold); ret = wl1271_cmd_configure(wl, ACX_TX_CONFIG_OPT, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("Setting of tx options failed: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_aid(struct wl1271 *wl, u16 aid) { struct acx_aid *acx_aid; int ret; wl1271_debug(DEBUG_ACX, "acx aid"); acx_aid = kzalloc(sizeof(*acx_aid), GFP_KERNEL); if (!acx_aid) { ret = -ENOMEM; goto out; } acx_aid->aid = cpu_to_le16(aid); ret = wl1271_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid)); if (ret < 0) { wl1271_warning("failed to set aid: %d", ret); goto out; } out: kfree(acx_aid); return ret; }
int wl1271_acx_mem_cfg(struct wl1271 *wl) { struct wl1271_acx_config_memory *mem_conf; int ret; wl1271_debug(DEBUG_ACX, "wl1271 mem cfg"); mem_conf = kzalloc(sizeof(*mem_conf), GFP_KERNEL); if (!mem_conf) { ret = -ENOMEM; goto out; } /* memory config */ mem_conf->num_stations = DEFAULT_NUM_STATIONS; mem_conf->rx_mem_block_num = ACX_RX_MEM_BLOCKS; mem_conf->tx_min_mem_block_num = ACX_TX_MIN_MEM_BLOCKS; mem_conf->num_ssid_profiles = ACX_NUM_SSID_PROFILES; mem_conf->total_tx_descriptors = cpu_to_le32(ACX_TX_DESCRIPTORS); ret = wl1271_cmd_configure(wl, ACX_MEM_CFG, mem_conf, sizeof(*mem_conf)); if (ret < 0) { wl1271_warning("wl1271 mem config failed: %d", ret); goto out; } out: kfree(mem_conf); return ret; }
int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask) { struct acx_event_mask *mask; int ret; wl1271_debug(DEBUG_ACX, "acx event mbox mask"); mask = kzalloc(sizeof(*mask), GFP_KERNEL); if (!mask) { ret = -ENOMEM; goto out; } /* high event mask is unused */ mask->high_event_mask = cpu_to_le32(0xffffffff); mask->event_mask = cpu_to_le32(event_mask); ret = wl1271_cmd_configure(wl, ACX_EVENT_MBOX_MASK, mask, sizeof(*mask)); if (ret < 0) { wl1271_warning("failed to set acx_event_mbox_mask: %d", ret); goto out; } out: kfree(mask); return ret; }
int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap) { struct wl1271_acx_host_config_bitmap *bitmap_conf; int ret; bitmap_conf = kzalloc(sizeof(*bitmap_conf), GFP_KERNEL); if (!bitmap_conf) { ret = -ENOMEM; goto out; } bitmap_conf->host_cfg_bitmap = cpu_to_le32(host_cfg_bitmap); ret = wl1271_cmd_configure(wl, ACX_HOST_IF_CFG_BITMAP, bitmap_conf, sizeof(*bitmap_conf)); if (ret < 0) { wl1271_warning("wl1271 bitmap config opt failed: %d", ret); goto out; } out: kfree(bitmap_conf); return ret; }
int wl1271_acx_set_preamble(struct wl1271 *wl, enum acx_preamble_type preamble) { struct acx_preamble *acx; int ret; wl1271_debug(DEBUG_ACX, "acx_set_preamble"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->preamble = preamble; ret = wl1271_cmd_configure(wl, ACX_PREAMBLE_TYPE, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("Setting of preamble failed: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_bet_enable(struct wl1271 *wl, bool enable) { struct wl1271_acx_bet_enable *acx = NULL; int ret = 0; wl1271_debug(DEBUG_ACX, "acx bet enable"); if (enable && wl->conf.conn.bet_enable == CONF_BET_MODE_DISABLE) goto out; acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->role_id = wl->role_id; acx->enable = enable ? CONF_BET_MODE_ENABLE : CONF_BET_MODE_DISABLE; acx->max_consecutive = wl->conf.conn.bet_max_consecutive; ret = wl1271_cmd_configure(wl, ACX_BET_ENABLE, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("acx bet enable failed: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_cts_protect(struct wl1271 *wl, enum acx_ctsprotect_type ctsprotect) { struct acx_ctsprotect *acx; int ret; wl1271_debug(DEBUG_ACX, "acx_set_ctsprotect"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->ctsprotect = ctsprotect; ret = wl1271_cmd_configure(wl, ACX_CTS_PROTECTION, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("Setting of ctsprotect failed: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_feature_cfg(struct wl1271 *wl) { struct acx_feature_config *feature; int ret; wl1271_debug(DEBUG_ACX, "acx feature cfg"); feature = kzalloc(sizeof(*feature), GFP_KERNEL); if (!feature) { ret = -ENOMEM; goto out; } /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */ feature->role_id = wl->role_id; feature->data_flow_options = 0; feature->options = 0; ret = wl1271_cmd_configure(wl, ACX_FEATURE_CFG, feature, sizeof(*feature)); if (ret < 0) { wl1271_error("Couldnt set HW encryption"); goto out; } out: kfree(feature); return ret; }
int wl1271_acx_ac_cfg(struct wl1271 *wl, u8 ac, u8 cw_min, u16 cw_max, u8 aifsn, u16 txop) { struct acx_ac_cfg *acx; int ret = 0; wl1271_debug(DEBUG_ACX, "acx ac cfg %d cw_ming %d cw_max %d " "aifs %d txop %d", ac, cw_min, cw_max, aifsn, txop); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->ac = ac; acx->cw_min = cw_min; acx->cw_max = cpu_to_le16(cw_max); acx->aifsn = aifsn; acx->tx_op_limit = cpu_to_le16(txop); ret = wl1271_cmd_configure(wl, ACX_AC_CFG, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("acx ac cfg failed: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_keep_alive_mode(struct wl1271 *wl, bool enable) { struct wl1271_acx_keep_alive_mode *acx = NULL; int ret = 0; wl1271_debug(DEBUG_ACX, "acx keep alive mode: %d", enable); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->role_id = wl->role_id; acx->enabled = enable; ret = wl1271_cmd_configure(wl, ACX_KEEP_ALIVE_MODE, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("acx keep alive mode failed: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type, u8 tsid, u8 ps_scheme, u8 ack_policy, u32 apsd_conf0, u32 apsd_conf1) { struct acx_tid_config *acx; int ret = 0; wl1271_debug(DEBUG_ACX, "acx tid config"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->queue_id = queue_id; acx->channel_type = channel_type; acx->tsid = tsid; acx->ps_scheme = ps_scheme; acx->ack_policy = ack_policy; acx->apsd_conf[0] = cpu_to_le32(apsd_conf0); acx->apsd_conf[1] = cpu_to_le32(apsd_conf1); ret = wl1271_cmd_configure(wl, ACX_TID_CFG, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("Setting of tid config failed: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_rssi_snr_avg_weights(struct wl1271 *wl) { struct wl1271_acx_rssi_snr_avg_weights *acx = NULL; struct conf_roam_trigger_settings *c = &wl->conf.roam_trigger; int ret = 0; wl1271_debug(DEBUG_ACX, "acx rssi snr avg weights"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->role_id = wl->role_id; acx->rssi_beacon = c->avg_weight_rssi_beacon; acx->rssi_data = c->avg_weight_rssi_data; acx->snr_beacon = c->avg_weight_snr_beacon; acx->snr_data = c->avg_weight_snr_data; ret = wl1271_cmd_configure(wl, ACX_RSSI_SNR_WEIGHTS, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("acx rssi snr trigger weights failed: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_frag_threshold(struct wl1271 *wl) { struct acx_frag_threshold *acx; int ret = 0; wl1271_debug(DEBUG_ACX, "acx frag threshold"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } acx->frag_threshold = cpu_to_le16(wl->conf.tx.frag_threshold); ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("Setting of frag threshold failed: %d", ret); goto out; } out: kfree(acx); return ret; }
/* Configure BA session initiator/receiver parameters setting in the FW. */ int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl) { struct wl1271_acx_ba_initiator_policy *acx; int ret; wl1271_debug(DEBUG_ACX, "acx ba initiator policy"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } /* set for the current role */ acx->role_id = wl->role_id; acx->tid_bitmap = wl->conf.ht.tx_ba_tid_bitmap; acx->win_size = wl->conf.ht.tx_ba_win_size; acx->inactivity_timeout = wl->conf.ht.inactivity_timeout; ret = wl1271_cmd_configure(wl, ACX_BA_SESSION_INIT_POLICY, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("acx ba initiator policy failed: %d", ret); goto out; } out: kfree(acx); return ret; }
int wl1271_acx_group_address_tbl(struct wl1271 *wl, bool enable, void *mc_list, u32 mc_list_len) { struct acx_dot11_grp_addr_tbl *acx; int ret; wl1271_debug(DEBUG_ACX, "acx group address tbl"); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; } /* MAC filtering */ acx->enabled = enable; acx->num_groups = mc_list_len; memcpy(acx->mac_table, mc_list, mc_list_len * ETH_ALEN); ret = wl1271_cmd_configure(wl, DOT11_GROUP_ADDRESS_TBL, acx, sizeof(*acx)); if (ret < 0) { wl1271_warning("failed to set group addr table: %d", ret); goto out; } out: kfree(acx); return ret; }