Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
[linux-2.6-microblaze.git] / drivers / net / wireless / ath / ath10k / wmi-tlv.c
index 8fdba38..b5849b3 100644 (file)
@@ -377,12 +377,34 @@ static int ath10k_wmi_tlv_event_tx_pause(struct ath10k *ar,
                   "wmi tlv tx pause pause_id %u action %u vdev_map 0x%08x peer_id %u tid_map 0x%08x\n",
                   pause_id, action, vdev_map, peer_id, tid_map);
 
-       for (vdev_id = 0; vdev_map; vdev_id++) {
-               if (!(vdev_map & BIT(vdev_id)))
-                       continue;
-
-               vdev_map &= ~BIT(vdev_id);
-               ath10k_mac_handle_tx_pause(ar, vdev_id, pause_id, action);
+       switch (pause_id) {
+       case WMI_TLV_TX_PAUSE_ID_MCC:
+       case WMI_TLV_TX_PAUSE_ID_P2P_CLI_NOA:
+       case WMI_TLV_TX_PAUSE_ID_P2P_GO_PS:
+       case WMI_TLV_TX_PAUSE_ID_AP_PS:
+       case WMI_TLV_TX_PAUSE_ID_IBSS_PS:
+               for (vdev_id = 0; vdev_map; vdev_id++) {
+                       if (!(vdev_map & BIT(vdev_id)))
+                               continue;
+
+                       vdev_map &= ~BIT(vdev_id);
+                       ath10k_mac_handle_tx_pause_vdev(ar, vdev_id, pause_id,
+                                                       action);
+               }
+               break;
+       case WMI_TLV_TX_PAUSE_ID_AP_PEER_PS:
+       case WMI_TLV_TX_PAUSE_ID_AP_PEER_UAPSD:
+       case WMI_TLV_TX_PAUSE_ID_STA_ADD_BA:
+       case WMI_TLV_TX_PAUSE_ID_HOST:
+               ath10k_dbg(ar, ATH10K_DBG_MAC,
+                          "mac ignoring unsupported tx pause id %d\n",
+                          pause_id);
+               break;
+       default:
+               ath10k_dbg(ar, ATH10K_DBG_MAC,
+                          "mac ignoring unknown tx pause vdev %d\n",
+                          pause_id);
+               break;
        }
 
        kfree(tb);
@@ -497,7 +519,7 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct sk_buff *skb)
                break;
        case WMI_TLV_SERVICE_READY_EVENTID:
                ath10k_wmi_event_service_ready(ar, skb);
-               break;
+               return;
        case WMI_TLV_READY_EVENTID:
                ath10k_wmi_event_ready(ar, skb);
                break;
@@ -709,6 +731,8 @@ static int ath10k_wmi_tlv_swba_tim_parse(struct ath10k *ar, u16 tag, u16 len,
                                         const void *ptr, void *data)
 {
        struct wmi_tlv_swba_parse *swba = data;
+       struct wmi_tim_info_arg *tim_info_arg;
+       const struct wmi_tim_info *tim_info_ev = ptr;
 
        if (tag != WMI_TLV_TAG_STRUCT_TIM_INFO)
                return -EPROTO;
@@ -716,7 +740,21 @@ static int ath10k_wmi_tlv_swba_tim_parse(struct ath10k *ar, u16 tag, u16 len,
        if (swba->n_tim >= ARRAY_SIZE(swba->arg->tim_info))
                return -ENOBUFS;
 
-       swba->arg->tim_info[swba->n_tim++] = ptr;
+       if (__le32_to_cpu(tim_info_ev->tim_len) >
+            sizeof(tim_info_ev->tim_bitmap)) {
+               ath10k_warn(ar, "refusing to parse invalid swba structure\n");
+               return -EPROTO;
+       }
+
+       tim_info_arg = &swba->arg->tim_info[swba->n_tim];
+       tim_info_arg->tim_len = tim_info_ev->tim_len;
+       tim_info_arg->tim_mcast = tim_info_ev->tim_mcast;
+       tim_info_arg->tim_bitmap = tim_info_ev->tim_bitmap;
+       tim_info_arg->tim_changed = tim_info_ev->tim_changed;
+       tim_info_arg->tim_num_ps_pending = tim_info_ev->tim_num_ps_pending;
+
+       swba->n_tim++;
+
        return 0;
 }
 
@@ -800,9 +838,9 @@ static int ath10k_wmi_tlv_op_pull_swba_ev(struct ath10k *ar,
        return 0;
 }
 
-static int ath10k_wmi_tlv_op_pull_phyerr_ev(struct ath10k *ar,
-                                           struct sk_buff *skb,
-                                           struct wmi_phyerr_ev_arg *arg)
+static int ath10k_wmi_tlv_op_pull_phyerr_ev_hdr(struct ath10k *ar,
+                                               struct sk_buff *skb,
+                                               struct wmi_phyerr_hdr_arg *arg)
 {
        const void **tb;
        const struct wmi_tlv_phyerr_ev *ev;
@@ -824,10 +862,10 @@ static int ath10k_wmi_tlv_op_pull_phyerr_ev(struct ath10k *ar,
                return -EPROTO;
        }
 
-       arg->num_phyerrs  = ev->num_phyerrs;
-       arg->tsf_l32 = ev->tsf_l32;
-       arg->tsf_u32 = ev->tsf_u32;
-       arg->buf_len = ev->buf_len;
+       arg->num_phyerrs  = __le32_to_cpu(ev->num_phyerrs);
+       arg->tsf_l32 = __le32_to_cpu(ev->tsf_l32);
+       arg->tsf_u32 = __le32_to_cpu(ev->tsf_u32);
+       arg->buf_len = __le32_to_cpu(ev->buf_len);
        arg->phyerrs = phyerrs;
 
        kfree(tb);
@@ -1241,6 +1279,11 @@ ath10k_wmi_tlv_op_gen_pdev_set_rd(struct ath10k *ar,
        return skb;
 }
 
+static enum wmi_txbf_conf ath10k_wmi_tlv_txbf_conf_scheme(struct ath10k *ar)
+{
+       return WMI_TXBF_CONF_AFTER_ASSOC;
+}
+
 static struct sk_buff *
 ath10k_wmi_tlv_op_gen_pdev_set_param(struct ath10k *ar, u32 param_id,
                                     u32 param_value)
@@ -1335,7 +1378,7 @@ static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar)
        cfg->rx_timeout_pri[1] = __cpu_to_le32(0x64);
        cfg->rx_timeout_pri[2] = __cpu_to_le32(0x64);
        cfg->rx_timeout_pri[3] = __cpu_to_le32(0x28);
-       cfg->rx_decap_mode = __cpu_to_le32(1);
+       cfg->rx_decap_mode = __cpu_to_le32(ar->wmi.rx_decap_mode);
        cfg->scan_max_pending_reqs = __cpu_to_le32(4);
        cfg->bmiss_offload_max_vdev = __cpu_to_le32(TARGET_TLV_NUM_VDEVS);
        cfg->roam_offload_max_vdev = __cpu_to_le32(TARGET_TLV_NUM_VDEVS);
@@ -3151,6 +3194,38 @@ static struct wmi_cmd_map wmi_tlv_cmd_map = {
        .tdls_set_state_cmdid = WMI_TLV_TDLS_SET_STATE_CMDID,
        .tdls_peer_update_cmdid = WMI_TLV_TDLS_PEER_UPDATE_CMDID,
        .adaptive_qcs_cmdid = WMI_TLV_RESMGR_ADAPTIVE_OCS_CMDID,
+       .scan_update_request_cmdid = WMI_CMD_UNSUPPORTED,
+       .vdev_standby_response_cmdid = WMI_CMD_UNSUPPORTED,
+       .vdev_resume_response_cmdid = WMI_CMD_UNSUPPORTED,
+       .wlan_peer_caching_add_peer_cmdid = WMI_CMD_UNSUPPORTED,
+       .wlan_peer_caching_evict_peer_cmdid = WMI_CMD_UNSUPPORTED,
+       .wlan_peer_caching_restore_peer_cmdid = WMI_CMD_UNSUPPORTED,
+       .wlan_peer_caching_print_all_peers_info_cmdid = WMI_CMD_UNSUPPORTED,
+       .peer_update_wds_entry_cmdid = WMI_CMD_UNSUPPORTED,
+       .peer_add_proxy_sta_entry_cmdid = WMI_CMD_UNSUPPORTED,
+       .rtt_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
+       .oem_req_cmdid = WMI_CMD_UNSUPPORTED,
+       .nan_cmdid = WMI_CMD_UNSUPPORTED,
+       .vdev_ratemask_cmdid = WMI_CMD_UNSUPPORTED,
+       .qboost_cfg_cmdid = WMI_CMD_UNSUPPORTED,
+       .pdev_smart_ant_enable_cmdid = WMI_CMD_UNSUPPORTED,
+       .pdev_smart_ant_set_rx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
+       .peer_smart_ant_set_tx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
+       .peer_smart_ant_set_train_info_cmdid = WMI_CMD_UNSUPPORTED,
+       .peer_smart_ant_set_node_config_ops_cmdid = WMI_CMD_UNSUPPORTED,
+       .pdev_set_antenna_switch_table_cmdid = WMI_CMD_UNSUPPORTED,
+       .pdev_set_ctl_table_cmdid = WMI_CMD_UNSUPPORTED,
+       .pdev_set_mimogain_table_cmdid = WMI_CMD_UNSUPPORTED,
+       .pdev_ratepwr_table_cmdid = WMI_CMD_UNSUPPORTED,
+       .pdev_ratepwr_chainmsk_table_cmdid = WMI_CMD_UNSUPPORTED,
+       .pdev_fips_cmdid = WMI_CMD_UNSUPPORTED,
+       .tt_set_conf_cmdid = WMI_CMD_UNSUPPORTED,
+       .fwtest_cmdid = WMI_CMD_UNSUPPORTED,
+       .vdev_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
+       .peer_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
+       .pdev_get_ani_cck_config_cmdid = WMI_CMD_UNSUPPORTED,
+       .pdev_get_ani_ofdm_config_cmdid = WMI_CMD_UNSUPPORTED,
+       .pdev_reserve_ast_entry_cmdid = WMI_CMD_UNSUPPORTED,
 };
 
 static struct wmi_pdev_param_map wmi_tlv_pdev_param_map = {
@@ -3204,6 +3279,48 @@ static struct wmi_pdev_param_map wmi_tlv_pdev_param_map = {
        .burst_dur = WMI_TLV_PDEV_PARAM_BURST_DUR,
        .burst_enable = WMI_TLV_PDEV_PARAM_BURST_ENABLE,
        .cal_period = WMI_PDEV_PARAM_UNSUPPORTED,
+       .aggr_burst = WMI_PDEV_PARAM_UNSUPPORTED,
+       .rx_decap_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+       .smart_antenna_default_antenna = WMI_PDEV_PARAM_UNSUPPORTED,
+       .igmpmld_override = WMI_PDEV_PARAM_UNSUPPORTED,
+       .igmpmld_tid = WMI_PDEV_PARAM_UNSUPPORTED,
+       .antenna_gain = WMI_PDEV_PARAM_UNSUPPORTED,
+       .rx_filter = WMI_PDEV_PARAM_UNSUPPORTED,
+       .set_mcast_to_ucast_tid = WMI_PDEV_PARAM_UNSUPPORTED,
+       .proxy_sta_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+       .set_mcast2ucast_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+       .set_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
+       .remove_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
+       .peer_sta_ps_statechg_enable = WMI_PDEV_PARAM_UNSUPPORTED,
+       .igmpmld_ac_override = WMI_PDEV_PARAM_UNSUPPORTED,
+       .block_interbss = WMI_PDEV_PARAM_UNSUPPORTED,
+       .set_disable_reset_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+       .set_msdu_ttl_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+       .set_ppdu_duration_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+       .txbf_sound_period_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+       .set_promisc_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+       .set_burst_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+       .en_stats = WMI_PDEV_PARAM_UNSUPPORTED,
+       .mu_group_policy = WMI_PDEV_PARAM_UNSUPPORTED,
+       .noise_detection = WMI_PDEV_PARAM_UNSUPPORTED,
+       .noise_threshold = WMI_PDEV_PARAM_UNSUPPORTED,
+       .dpd_enable = WMI_PDEV_PARAM_UNSUPPORTED,
+       .set_mcast_bcast_echo = WMI_PDEV_PARAM_UNSUPPORTED,
+       .atf_strict_sch = WMI_PDEV_PARAM_UNSUPPORTED,
+       .atf_sched_duration = WMI_PDEV_PARAM_UNSUPPORTED,
+       .ant_plzn = WMI_PDEV_PARAM_UNSUPPORTED,
+       .mgmt_retry_limit = WMI_PDEV_PARAM_UNSUPPORTED,
+       .sensitivity_level = WMI_PDEV_PARAM_UNSUPPORTED,
+       .signed_txpower_2g = WMI_PDEV_PARAM_UNSUPPORTED,
+       .signed_txpower_5g = WMI_PDEV_PARAM_UNSUPPORTED,
+       .enable_per_tid_amsdu = WMI_PDEV_PARAM_UNSUPPORTED,
+       .enable_per_tid_ampdu = WMI_PDEV_PARAM_UNSUPPORTED,
+       .cca_threshold = WMI_PDEV_PARAM_UNSUPPORTED,
+       .rts_fixed_rate = WMI_PDEV_PARAM_UNSUPPORTED,
+       .pdev_reset = WMI_PDEV_PARAM_UNSUPPORTED,
+       .wapi_mbssid_offset = WMI_PDEV_PARAM_UNSUPPORTED,
+       .arp_srcaddr = WMI_PDEV_PARAM_UNSUPPORTED,
+       .arp_dstaddr = WMI_PDEV_PARAM_UNSUPPORTED,
 };
 
 static struct wmi_vdev_param_map wmi_tlv_vdev_param_map = {
@@ -3262,6 +3379,22 @@ static struct wmi_vdev_param_map wmi_tlv_vdev_param_map = {
        .tx_encap_type = WMI_TLV_VDEV_PARAM_TX_ENCAP_TYPE,
        .ap_detect_out_of_sync_sleeping_sta_time_secs =
                                        WMI_TLV_VDEV_PARAM_UNSUPPORTED,
+       .rc_num_retries = WMI_VDEV_PARAM_UNSUPPORTED,
+       .cabq_maxdur = WMI_VDEV_PARAM_UNSUPPORTED,
+       .mfptest_set = WMI_VDEV_PARAM_UNSUPPORTED,
+       .rts_fixed_rate = WMI_VDEV_PARAM_UNSUPPORTED,
+       .vht_sgimask = WMI_VDEV_PARAM_UNSUPPORTED,
+       .vht80_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
+       .early_rx_adjust_enable = WMI_VDEV_PARAM_UNSUPPORTED,
+       .early_rx_tgt_bmiss_num = WMI_VDEV_PARAM_UNSUPPORTED,
+       .early_rx_bmiss_sample_cycle = WMI_VDEV_PARAM_UNSUPPORTED,
+       .early_rx_slop_step = WMI_VDEV_PARAM_UNSUPPORTED,
+       .early_rx_init_slop = WMI_VDEV_PARAM_UNSUPPORTED,
+       .early_rx_adjust_pause = WMI_VDEV_PARAM_UNSUPPORTED,
+       .proxy_sta = WMI_VDEV_PARAM_UNSUPPORTED,
+       .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED,
+       .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED,
+       .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
 };
 
 static const struct wmi_ops wmi_tlv_ops = {
@@ -3274,12 +3407,14 @@ static const struct wmi_ops wmi_tlv_ops = {
        .pull_vdev_start = ath10k_wmi_tlv_op_pull_vdev_start_ev,
        .pull_peer_kick = ath10k_wmi_tlv_op_pull_peer_kick_ev,
        .pull_swba = ath10k_wmi_tlv_op_pull_swba_ev,
-       .pull_phyerr = ath10k_wmi_tlv_op_pull_phyerr_ev,
+       .pull_phyerr_hdr = ath10k_wmi_tlv_op_pull_phyerr_ev_hdr,
+       .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev,
        .pull_svc_rdy = ath10k_wmi_tlv_op_pull_svc_rdy_ev,
        .pull_rdy = ath10k_wmi_tlv_op_pull_rdy_ev,
        .pull_fw_stats = ath10k_wmi_tlv_op_pull_fw_stats,
        .pull_roam_ev = ath10k_wmi_tlv_op_pull_roam_ev,
        .pull_wow_event = ath10k_wmi_tlv_op_pull_wow_ev,
+       .get_txbf_conf_scheme = ath10k_wmi_tlv_txbf_conf_scheme,
 
        .gen_pdev_suspend = ath10k_wmi_tlv_op_gen_pdev_suspend,
        .gen_pdev_resume = ath10k_wmi_tlv_op_gen_pdev_resume,