aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/wil6210/wmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/wil6210/wmi.c')
-rw-r--r--drivers/net/wireless/ath/wil6210/wmi.c83
1 files changed, 65 insertions, 18 deletions
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c
index 345f05969190..bda4a9712f91 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. 2 * Copyright (c) 2012-2017 Qualcomm Atheros, Inc.
3 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 3 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
4 * 4 *
5 * Permission to use, copy, modify, and/or distribute this software for any 5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above 6 * purpose with or without fee is hereby granted, provided that the above
@@ -24,8 +24,9 @@
24#include "wmi.h" 24#include "wmi.h"
25#include "trace.h" 25#include "trace.h"
26 26
27static uint max_assoc_sta = WIL6210_MAX_CID; 27/* set the default max assoc sta to max supported by driver */
28module_param(max_assoc_sta, uint, 0644); 28uint max_assoc_sta = WIL6210_MAX_CID;
29module_param(max_assoc_sta, uint, 0444);
29MODULE_PARM_DESC(max_assoc_sta, " Max number of stations associated to the AP"); 30MODULE_PARM_DESC(max_assoc_sta, " Max number of stations associated to the AP");
30 31
31int agg_wsize; /* = 0; */ 32int agg_wsize; /* = 0; */
@@ -770,6 +771,7 @@ static void wmi_evt_ready(struct wil6210_vif *vif, int id, void *d, int len)
770 struct wil6210_priv *wil = vif_to_wil(vif); 771 struct wil6210_priv *wil = vif_to_wil(vif);
771 struct wiphy *wiphy = wil_to_wiphy(wil); 772 struct wiphy *wiphy = wil_to_wiphy(wil);
772 struct wmi_ready_event *evt = d; 773 struct wmi_ready_event *evt = d;
774 u8 fw_max_assoc_sta;
773 775
774 wil_info(wil, "FW ver. %s(SW %d); MAC %pM; %d MID's\n", 776 wil_info(wil, "FW ver. %s(SW %d); MAC %pM; %d MID's\n",
775 wil->fw_version, le32_to_cpu(evt->sw_version), 777 wil->fw_version, le32_to_cpu(evt->sw_version),
@@ -787,6 +789,25 @@ static void wmi_evt_ready(struct wil6210_vif *vif, int id, void *d, int len)
787 evt->rfc_read_calib_result); 789 evt->rfc_read_calib_result);
788 wil->fw_calib_result = evt->rfc_read_calib_result; 790 wil->fw_calib_result = evt->rfc_read_calib_result;
789 } 791 }
792
793 fw_max_assoc_sta = WIL6210_RX_DESC_MAX_CID;
794 if (len > offsetof(struct wmi_ready_event, max_assoc_sta) &&
795 evt->max_assoc_sta > 0) {
796 fw_max_assoc_sta = evt->max_assoc_sta;
797 wil_dbg_wmi(wil, "fw reported max assoc sta %d\n",
798 fw_max_assoc_sta);
799
800 if (fw_max_assoc_sta > WIL6210_MAX_CID) {
801 wil_dbg_wmi(wil,
802 "fw max assoc sta %d exceeds max driver supported %d\n",
803 fw_max_assoc_sta, WIL6210_MAX_CID);
804 fw_max_assoc_sta = WIL6210_MAX_CID;
805 }
806 }
807
808 max_assoc_sta = min_t(uint, max_assoc_sta, fw_max_assoc_sta);
809 wil_dbg_wmi(wil, "setting max assoc sta to %d\n", max_assoc_sta);
810
790 wil_set_recovery_state(wil, fw_recovery_idle); 811 wil_set_recovery_state(wil, fw_recovery_idle);
791 set_bit(wil_status_fwready, wil->status); 812 set_bit(wil_status_fwready, wil->status);
792 /* let the reset sequence continue */ 813 /* let the reset sequence continue */
@@ -952,7 +973,7 @@ static void wmi_evt_connect(struct wil6210_vif *vif, int id, void *d, int len)
952 evt->assoc_req_len, evt->assoc_resp_len); 973 evt->assoc_req_len, evt->assoc_resp_len);
953 return; 974 return;
954 } 975 }
955 if (evt->cid >= WIL6210_MAX_CID) { 976 if (evt->cid >= max_assoc_sta) {
956 wil_err(wil, "Connect CID invalid : %d\n", evt->cid); 977 wil_err(wil, "Connect CID invalid : %d\n", evt->cid);
957 return; 978 return;
958 } 979 }
@@ -1271,9 +1292,16 @@ static void wmi_evt_addba_rx_req(struct wil6210_vif *vif, int id,
1271 void *d, int len) 1292 void *d, int len)
1272{ 1293{
1273 struct wil6210_priv *wil = vif_to_wil(vif); 1294 struct wil6210_priv *wil = vif_to_wil(vif);
1295 u8 cid, tid;
1274 struct wmi_rcp_addba_req_event *evt = d; 1296 struct wmi_rcp_addba_req_event *evt = d;
1275 1297
1276 wil_addba_rx_request(wil, vif->mid, evt->cidxtid, evt->dialog_token, 1298 if (evt->cidxtid != CIDXTID_EXTENDED_CID_TID) {
1299 parse_cidxtid(evt->cidxtid, &cid, &tid);
1300 } else {
1301 cid = evt->cid;
1302 tid = evt->tid;
1303 }
1304 wil_addba_rx_request(wil, vif->mid, cid, tid, evt->dialog_token,
1277 evt->ba_param_set, evt->ba_timeout, 1305 evt->ba_param_set, evt->ba_timeout,
1278 evt->ba_seq_ctrl); 1306 evt->ba_seq_ctrl);
1279} 1307}
@@ -1289,7 +1317,13 @@ __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock)
1289 struct wil_tid_ampdu_rx *r; 1317 struct wil_tid_ampdu_rx *r;
1290 1318
1291 might_sleep(); 1319 might_sleep();
1292 parse_cidxtid(evt->cidxtid, &cid, &tid); 1320
1321 if (evt->cidxtid != CIDXTID_EXTENDED_CID_TID) {
1322 parse_cidxtid(evt->cidxtid, &cid, &tid);
1323 } else {
1324 cid = evt->cid;
1325 tid = evt->tid;
1326 }
1293 wil_dbg_wmi(wil, "DELBA MID %d CID %d TID %d from %s reason %d\n", 1327 wil_dbg_wmi(wil, "DELBA MID %d CID %d TID %d from %s reason %d\n",
1294 vif->mid, cid, tid, 1328 vif->mid, cid, tid,
1295 evt->from_initiator ? "originator" : "recipient", 1329 evt->from_initiator ? "originator" : "recipient",
@@ -1404,7 +1438,7 @@ static void wil_link_stats_store_basic(struct wil6210_vif *vif,
1404 u8 cid = basic->cid; 1438 u8 cid = basic->cid;
1405 struct wil_sta_info *sta; 1439 struct wil_sta_info *sta;
1406 1440
1407 if (cid < 0 || cid >= WIL6210_MAX_CID) { 1441 if (cid < 0 || cid >= max_assoc_sta) {
1408 wil_err(wil, "invalid cid %d\n", cid); 1442 wil_err(wil, "invalid cid %d\n", cid);
1409 return; 1443 return;
1410 } 1444 }
@@ -1554,7 +1588,7 @@ static int wil_find_cid_ringid_sta(struct wil6210_priv *wil,
1554 continue; 1588 continue;
1555 1589
1556 lcid = wil->ring2cid_tid[i][0]; 1590 lcid = wil->ring2cid_tid[i][0];
1557 if (lcid >= WIL6210_MAX_CID) /* skip BCAST */ 1591 if (lcid >= max_assoc_sta) /* skip BCAST */
1558 continue; 1592 continue;
1559 1593
1560 wil_dbg_wmi(wil, "find sta -> ringid %d cid %d\n", i, lcid); 1594 wil_dbg_wmi(wil, "find sta -> ringid %d cid %d\n", i, lcid);
@@ -2120,10 +2154,9 @@ int wmi_pcp_start(struct wil6210_vif *vif,
2120 2154
2121 if ((cmd.pcp_max_assoc_sta > WIL6210_MAX_CID) || 2155 if ((cmd.pcp_max_assoc_sta > WIL6210_MAX_CID) ||
2122 (cmd.pcp_max_assoc_sta <= 0)) { 2156 (cmd.pcp_max_assoc_sta <= 0)) {
2123 wil_info(wil, 2157 wil_err(wil, "unexpected max_assoc_sta %d\n",
2124 "Requested connection limit %u, valid values are 1 - %d. Setting to %d\n", 2158 cmd.pcp_max_assoc_sta);
2125 max_assoc_sta, WIL6210_MAX_CID, WIL6210_MAX_CID); 2159 return -EOPNOTSUPP;
2126 cmd.pcp_max_assoc_sta = WIL6210_MAX_CID;
2127 } 2160 }
2128 2161
2129 if (disable_ap_sme && 2162 if (disable_ap_sme &&
@@ -2516,7 +2549,7 @@ int wmi_rx_chain_add(struct wil6210_priv *wil, struct wil_ring *vring)
2516 if (ch) 2549 if (ch)
2517 cmd.sniffer_cfg.channel = ch->hw_value - 1; 2550 cmd.sniffer_cfg.channel = ch->hw_value - 1;
2518 cmd.sniffer_cfg.phy_info_mode = 2551 cmd.sniffer_cfg.phy_info_mode =
2519 cpu_to_le32(ndev->type == ARPHRD_IEEE80211_RADIOTAP); 2552 cpu_to_le32(WMI_SNIFFER_PHY_INFO_DISABLED);
2520 cmd.sniffer_cfg.phy_support = 2553 cmd.sniffer_cfg.phy_support =
2521 cpu_to_le32((wil->monitor_flags & MONITOR_FLAG_CONTROL) 2554 cpu_to_le32((wil->monitor_flags & MONITOR_FLAG_CONTROL)
2522 ? WMI_SNIFFER_CP : WMI_SNIFFER_BOTH_PHYS); 2555 ? WMI_SNIFFER_CP : WMI_SNIFFER_BOTH_PHYS);
@@ -2651,15 +2684,22 @@ int wmi_delba_tx(struct wil6210_priv *wil, u8 mid, u8 ringid, u16 reason)
2651 return wmi_send(wil, WMI_RING_BA_DIS_CMDID, mid, &cmd, sizeof(cmd)); 2684 return wmi_send(wil, WMI_RING_BA_DIS_CMDID, mid, &cmd, sizeof(cmd));
2652} 2685}
2653 2686
2654int wmi_delba_rx(struct wil6210_priv *wil, u8 mid, u8 cidxtid, u16 reason) 2687int wmi_delba_rx(struct wil6210_priv *wil, u8 mid, u8 cid, u8 tid, u16 reason)
2655{ 2688{
2656 struct wmi_rcp_delba_cmd cmd = { 2689 struct wmi_rcp_delba_cmd cmd = {
2657 .cidxtid = cidxtid,
2658 .reason = cpu_to_le16(reason), 2690 .reason = cpu_to_le16(reason),
2659 }; 2691 };
2660 2692
2661 wil_dbg_wmi(wil, "delba_rx: (CID %d TID %d reason %d)\n", cidxtid & 0xf, 2693 if (cid >= WIL6210_RX_DESC_MAX_CID) {
2662 (cidxtid >> 4) & 0xf, reason); 2694 cmd.cidxtid = CIDXTID_EXTENDED_CID_TID;
2695 cmd.cid = cid;
2696 cmd.tid = tid;
2697 } else {
2698 cmd.cidxtid = mk_cidxtid(cid, tid);
2699 }
2700
2701 wil_dbg_wmi(wil, "delba_rx: (CID %d TID %d reason %d)\n", cid,
2702 tid, reason);
2663 2703
2664 return wmi_send(wil, WMI_RCP_DELBA_CMDID, mid, &cmd, sizeof(cmd)); 2704 return wmi_send(wil, WMI_RCP_DELBA_CMDID, mid, &cmd, sizeof(cmd));
2665} 2705}
@@ -2670,7 +2710,6 @@ int wmi_addba_rx_resp(struct wil6210_priv *wil,
2670{ 2710{
2671 int rc; 2711 int rc;
2672 struct wmi_rcp_addba_resp_cmd cmd = { 2712 struct wmi_rcp_addba_resp_cmd cmd = {
2673 .cidxtid = mk_cidxtid(cid, tid),
2674 .dialog_token = token, 2713 .dialog_token = token,
2675 .status_code = cpu_to_le16(status), 2714 .status_code = cpu_to_le16(status),
2676 /* bit 0: A-MSDU supported 2715 /* bit 0: A-MSDU supported
@@ -2689,6 +2728,14 @@ int wmi_addba_rx_resp(struct wil6210_priv *wil,
2689 .evt = {.status = cpu_to_le16(WMI_FW_STATUS_FAILURE)}, 2728 .evt = {.status = cpu_to_le16(WMI_FW_STATUS_FAILURE)},
2690 }; 2729 };
2691 2730
2731 if (cid >= WIL6210_RX_DESC_MAX_CID) {
2732 cmd.cidxtid = CIDXTID_EXTENDED_CID_TID;
2733 cmd.cid = cid;
2734 cmd.tid = tid;
2735 } else {
2736 cmd.cidxtid = mk_cidxtid(cid, tid);
2737 }
2738
2692 wil_dbg_wmi(wil, 2739 wil_dbg_wmi(wil,
2693 "ADDBA response for MID %d CID %d TID %d size %d timeout %d status %d AMSDU%s\n", 2740 "ADDBA response for MID %d CID %d TID %d size %d timeout %d status %d AMSDU%s\n",
2694 mid, cid, tid, agg_wsize, 2741 mid, cid, tid, agg_wsize,